From ashish.karalkar@info-spectrum.com Mon Sep 3 08:07:38 2007 Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 728BB9F9EA9 for ; Mon, 3 Sep 2007 05:07:38 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 63144-10 for ; Mon, 3 Sep 2007 05:07:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from pro33.abac.com (pro33.abac.com [66.226.64.34]) by postgresql.org (Postfix) with ESMTP id 2996A9F959C for ; Mon, 3 Sep 2007 05:07:34 -0300 (ADT) Received: from ashishk ([220.227.213.66]) (authenticated bits=0) by pro33.abac.com (8.14.1/8.14.1) with ESMTP id l8386qgY057890 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO) for ; Mon, 3 Sep 2007 01:07:20 -0700 (PDT) (envelope-from ashish.karalkar@info-spectrum.com) Message-ID: <011d01c7ee01$7a0fc3e0$170211ac@LIONKING.COM> From: "Ashish Karalkar" To: Subject: invalid byte sequence for encoding "UTF8": 0xff Date: Mon, 3 Sep 2007 13:36:58 +0530 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_011A_01C7EE2F.802C50D0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/50 X-Sequence-Number: 119974 This is a multi-part message in MIME format. ------=_NextPart_000_011A_01C7EE2F.802C50D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello All, I have a data script which runs fine from PgAdmin SQL Editor,but when I = run this from command prompt I get following error: test=3D# \i /usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql psql:/usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql:1: ERROR: = invalid byt e sequence for encoding "UTF8": 0xff HINT: This error can also happen if the byte sequence does not match = the encodi ng expected by the server, which is controlled by "client_encoding". can anybody suggest me what is going wrong. database encoding :UTF8 PostgreSQL details: version -------------------------------------------------------------------------= ------------------------------ PostgreSQL 8.2.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.3 = 20041212 (Red Hat 3.4.3-9.EL4) ------=_NextPart_000_011A_01C7EE2F.802C50D0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello All,
 
I have a data script which runs fine = from PgAdmin=20 SQL Editor,but when I  run this  from command prompt I = get=20 following error:
 
 
test=3D# \i=20 /usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql

psql:/usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql:1:= =20 ERROR:  invalid byt
e sequence for encoding "UTF8": = 0xff
HINT: =20 This error can also happen if the byte sequence does not match the = encodi
ng=20 expected by the server, which is controlled by=20 "client_encoding".
 
can anybody suggest me what is going=20 wrong.
database  encoding = :UTF8
 
PostgreSQL details:
 
 version
-----------------------------------------------= --------------------------------------------------------
 Postgre= SQL=20 8.2.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 3.4.3 20041212 = (Red Hat=20 3.4.3-9.EL4)
 
------=_NextPart_000_011A_01C7EE2F.802C50D0-- From kleptog@svana.org Mon Sep 3 08:16:11 2007 Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id F0CE09F9AE7 for ; Mon, 3 Sep 2007 05:16:11 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 94128-09 for ; Mon, 3 Sep 2007 05:16:04 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from svana.org (svana.org [203.190.233.187]) by postgresql.org (Postfix) with ESMTP id CDEA79F9BAD for ; Mon, 3 Sep 2007 05:16:06 -0300 (ADT) Received: from kleptog by svana.org with local (Exim 4.50) id 1IS76C-0006A2-F9; Mon, 03 Sep 2007 18:15:56 +1000 Date: Mon, 3 Sep 2007 10:15:56 +0200 From: Martijn van Oosterhout To: Ashish Karalkar Cc: pgsql-general@postgresql.org Subject: Re: invalid byte sequence for encoding "UTF8": 0xff Message-ID: <20070903081556.GA20844@svana.org> Reply-To: Martijn van Oosterhout Mail-Followup-To: Ashish Karalkar , pgsql-general@postgresql.org References: <011d01c7ee01$7a0fc3e0$170211ac@LIONKING.COM> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ikeVEW9yuYc//A+q" Content-Disposition: inline In-Reply-To: <011d01c7ee01$7a0fc3e0$170211ac@LIONKING.COM> X-PGP-Key-ID: Length=1024; ID=0x0DC67BE6 X-PGP-Key-Fingerprint: 295F A899 A81A 156D B522 48A7 6394 F08A 0DC6 7BE6 X-PGP-Key-URL: User-Agent: Mutt/1.5.9i X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: kleptog@svana.org X-SA-Exim-Scanned: No (on svana.org); SAEximRunCond expanded to false X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/51 X-Sequence-Number: 119975 --ikeVEW9yuYc//A+q Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Sep 03, 2007 at 01:36:58PM +0530, Ashish Karalkar wrote: > Hello All, >=20 > I have a data script which runs fine from PgAdmin SQL Editor,but when I = run this from command prompt I get following error: > test=3D# \i /usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql >=20 > psql:/usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql:1: ERROR: inva= lid byt > e sequence for encoding "UTF8": 0xff > HINT: This error can also happen if the byte sequence does not match the= encodi > ng expected by the server, which is controlled by "client_encoding". Well, the error is correct, that's not a valid UTF-8 character. I seem to remember someone saying that ooasionally windows puts BOMs in UTF-8 files (which is completely bogus). Check the file using a simple text editor a check if there are some odd characters at the beginning of the file. Have a ncie day, --=20 Martijn van Oosterhout http://svana.org/kleptog/ > From each according to his ability. To each according to his ability to l= itigate. --ikeVEW9yuYc//A+q Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) iD8DBQFG28K8IB7bNG8LQkwRAukkAJ4uMKZPz4UddK7HJ5WpCN/rPVn4GgCdEytO Owbc3ZmYldL+sa74ys/69X0= =UA4m -----END PGP SIGNATURE----- --ikeVEW9yuYc//A+q-- From all@adv.magwien.gv.at Mon Sep 3 08:42:45 2007 Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 228F19F9377 for ; Mon, 3 Sep 2007 05:42:45 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 83397-03 for ; Mon, 3 Sep 2007 05:42:37 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from fr112.ext.magwien.gv.at (relay-fr112.magwien.gv.at [217.149.225.66]) by postgresql.org (Postfix) with ESMTP id 66E4E9F9298 for ; Mon, 3 Sep 2007 05:42:40 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by fr112.ext.magwien.gv.at (Postfix) with ESMTP id 3FB576EF5C; Mon, 3 Sep 2007 10:42:39 +0200 (CEST) Received: from exrat0.host.magwien.gv.at (exrat0.host.magwien.gv.at [10.136.132.84]) by fr112.ext.magwien.gv.at (Postfix) with ESMTP id 21CBA6EF5B; Mon, 3 Sep 2007 10:42:38 +0200 (CEST) Received: from exadv11.host.magwien.gv.at ([10.152.172.59]) by exrat0.host.magwien.gv.at with Microsoft SMTPSVC(6.0.3790.211); Mon, 3 Sep 2007 10:42:38 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: invalid byte sequence for encoding "UTF8": 0xff Date: Mon, 3 Sep 2007 10:42:38 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [GENERAL] invalid byte sequence for encoding "UTF8": 0xff thread-index: AcfuBQLVgfj+422ZRp+CJio3rli4agAAJowg References: <011d01c7ee01$7a0fc3e0$170211ac@LIONKING.COM> From: "Albe Laurenz" To: "Ashish Karalkar *EXTERN*" , X-OriginalArrivalTime: 03 Sep 2007 08:42:38.0753 (UTC) FILETIME=[622AB910:01C7EE06] X-Virus-Scanned: by amavisd-new using Sophie and ClamAV at magwien.gv.at X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/53 X-Sequence-Number: 119977 Ashish Karalkar wrote: > I have a data script which runs fine from PgAdmin SQL=20 > Editor,but when I run this from command prompt I get=20 > following error: > =20 > =20 > test=3D# \i /usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql >=20 > psql:/usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql:1:=20 > ERROR: invalid byte sequence for encoding "UTF8": 0xff > HINT: This error can also happen if the byte sequence does=20 > not match the encoding expected by the server, which is > controlled by "client_encoding". > =20 > can anybody suggest me what is going wrong. > database encoding :UTF8 > =20 > PostgreSQL details: > =20 > version > -------------------------------------------------------------- > PostgreSQL 8.2.0 on i686-pc-linux-gnu, compiled by GCC gcc=20 > (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) Can you tell us the following: - What is the client operating system (where you run psql and PgAdmin III)? - What is the value of the environment variable PGCLIENTENCODING set to on the client? - What does the SQL command "show client_encoding;" return when you issue it in a) PgAdmin III b) psql - Please create a file that contains only the first line of QSWEB_100_4_Default_Data.sql (I call it "l" in the following commands), run the following two (Linux) commands on it: a) od -t c l b) od -t x1 l and show us the output of both commands. Yours, Laurenz Albe From ashish.karalkar@info-spectrum.com Mon Sep 3 10:48:00 2007 Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id E13069F947D for ; Mon, 3 Sep 2007 07:48:00 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 27628-01 for ; Mon, 3 Sep 2007 07:47:52 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from pro33.abac.com (pro33.abac.com [66.226.64.34]) by postgresql.org (Postfix) with ESMTP id 11A769F948F for ; Mon, 3 Sep 2007 07:47:55 -0300 (ADT) Received: from ashishk ([203.193.139.178]) (authenticated bits=0) by pro33.abac.com (8.14.1/8.14.1) with ESMTP id l83AlfVp034123 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Mon, 3 Sep 2007 03:47:45 -0700 (PDT) (envelope-from ashish.karalkar@info-spectrum.com) Message-ID: <001f01c7ee17$e05eb4b0$170211ac@LIONKING.COM> From: "Ashish Karalkar" To: "Albe Laurenz" Cc: Subject: Re: invalid byte sequence for encoding "UTF8": 0xff Date: Mon, 3 Sep 2007 16:17:31 +0530 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.982 tagged_above=0 required=5 tests=AWL=-0.845, BAYES_40=-0.185, FAKE_REPLY_C=2.012 X-Spam-Level: X-Archive-Number: 200709/58 X-Sequence-Number: 119982 ----- Original Message ----- From: "Ashish Karalkar" To: "Albe Laurenz" Sent: Monday, September 03, 2007 4:09 PM Subject: Re: [GENERAL] invalid byte sequence for encoding "UTF8": 0xff > > ----- Original Message ----- > From: "Albe Laurenz" > To: "Ashish Karalkar *EXTERN*" ; > > Sent: Monday, September 03, 2007 2:12 PM > Subject: Re: [GENERAL] invalid byte sequence for encoding "UTF8": 0xff > > > Ashish Karalkar wrote: >> I have a data script which runs fine from PgAdmin SQL >> Editor,but when I run this from command prompt I get >> following error: >> >> >> test=# \i /usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql >> >> psql:/usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql:1: >> ERROR: invalid byte sequence for encoding "UTF8": 0xff >> HINT: This error can also happen if the byte sequence does >> not match the encoding expected by the server, which is >> controlled by "client_encoding". >> >> can anybody suggest me what is going wrong. >> database encoding :UTF8 >> >> PostgreSQL details: >> >> version >> -------------------------------------------------------------- >> PostgreSQL 8.2.0 on i686-pc-linux-gnu, compiled by GCC gcc >> (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) > > Can you tell us the following: > > Please find my answer below > > - What is the client operating system (where you run psql and > PgAdmin III)? > > Its Windows XP - PgAdmin III > RHEL 3.4.3-9.EL4-psql (Server Machine) > > > - What is the value of the environment variable PGCLIENTENCODING > set to on the client? > PGCLIENTENCODING is not set and as per documantation I think by default it > takes value of database i.e. UTF8 > > - What does the SQL command "show client_encoding;" return > when you issue it in > a) PgAdmin III > UNICODE > b) psql > UTF8 > > - Please create a file that contains only the first line > of QSWEB_100_4_Default_Data.sql (I call it "l" in the following > commands), run the following two (Linux) commands on it: > a) od -t c l > b) od -t x1 l > and show us the output of both commands. > > > [root@localhost qsweb]# od -t c test.sql > 0000000 \ s e t O N _ E R R O R _ S T > 0000020 O P > 0000022 > [root@localhost qsweb]# od -t x1 test.sql > 0000000 5c 73 65 74 20 4f 4e 5f 45 52 52 4f 52 5f 53 54 > 0000020 4f 50 > 0000022 > [root@localhost qsweb]# > > Thanks Albe for your replay. > here is the data you wanted > > > Yours, > Laurenz Albe > > ---------------------------(end of broadcast)--------------------------- > TIP 4: Have you searched our list archives? > > http://archives.postgresql.org/ From all@adv.magwien.gv.at Mon Sep 3 11:24:42 2007 Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 256659F9DB2 for ; Mon, 3 Sep 2007 08:24:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 60597-08 for ; Mon, 3 Sep 2007 08:24:35 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from fr112.ext.magwien.gv.at (relay-fr112.magwien.gv.at [217.149.225.66]) by postgresql.org (Postfix) with ESMTP id 3EB7D9F9DBE for ; Mon, 3 Sep 2007 08:24:34 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by fr112.ext.magwien.gv.at (Postfix) with ESMTP id 851006F3CB; Mon, 3 Sep 2007 13:24:32 +0200 (CEST) Received: from exrat0.host.magwien.gv.at (exrat0.host.magwien.gv.at [10.136.132.84]) by fr112.ext.magwien.gv.at (Postfix) with ESMTP id 20CD16F3D3; Mon, 3 Sep 2007 13:24:32 +0200 (CEST) Received: from exadv11.host.magwien.gv.at ([10.152.172.59]) by exrat0.host.magwien.gv.at with Microsoft SMTPSVC(6.0.3790.211); Mon, 3 Sep 2007 13:24:13 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: invalid byte sequence for encoding "UTF8": 0xff Date: Mon, 3 Sep 2007 13:24:12 +0200 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [GENERAL] invalid byte sequence for encoding "UTF8": 0xff thread-index: AcfuF+SWCZXs1AIGQeuhuUWErysfSAAAfy8g References: <001f01c7ee17$e05eb4b0$170211ac@LIONKING.COM> From: "Albe Laurenz" To: "Ashish Karalkar *EXTERN*" Cc: X-OriginalArrivalTime: 03 Sep 2007 11:24:13.0348 (UTC) FILETIME=[F4988640:01C7EE1C] X-Virus-Scanned: by amavisd-new using Sophie and ClamAV at magwien.gv.at X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/59 X-Sequence-Number: 119983 Ashish Karalkar wrote: >>> I have a data script which runs fine from PgAdmin SQL >>> Editor,but when I run this from command prompt I get >>> following error: >>> >>> test=3D# \i /usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql >>> >>> psql:/usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql:1: >>> ERROR: invalid byte sequence for encoding "UTF8": 0xff >>> >>> version >>> -------------------------------------------------------------- >>> PostgreSQL 8.2.0 on i686-pc-linux-gnu, compiled by GCC gcc >>> (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) >> >> - What is the client operating system (where you run psql and >> PgAdmin III)? >> > Its Windows XP - PgAdmin III > RHEL 3.4.3-9.EL4-psql (Server Machine) So I get it that you run "psql" on Windows XP, right? > PGCLIENTENCODING is not set and as per documantation I=20 > think by default it takes value of database i.e. UTF8 > >> - What does the SQL command "show client_encoding;" return >> when you issue it in >> a) PgAdmin III > UNICODE >> b) psql > UTF8 Ok, I suspect that's your problem. You created QSWEB_100_4_Default_Data.sql by using the "Save" dialog in PgAdmin III on the Windows machine, right? Then the file will probably be encoded in Windows-1252. If your client_encoding is set to UTF8, psql will expect UTF-8 data in the SQL script and complain if it meets wrong ones. Does the script work as expected when you change the client encoding to WIN1252? >> - Please create a file that contains only the first line >> of QSWEB_100_4_Default_Data.sql (I call it "l" in the following >> commands), run the following two (Linux) commands on it: >> a) od -t c l >> b) od -t x1 l >> and show us the output of both commands. > > [root@localhost qsweb]# od -t c test.sql > 0000000 \ s e t O N _ E R R O R _ S T > 0000020 O P > 0000022 > [root@localhost qsweb]# od -t x1 test.sql > 0000000 5c 73 65 74 20 4f 4e 5f 45 52 52 4f 52 5f 53 54 > 0000020 4f 50 > 0000022 That's weird, because psql complained about line 1. Maybe you messed something up by extracting the first line. Try the following: - Use binary file transfer and transfer the SQL script to a Linux machine. - Run "od -t c -t x1" on the file - Find the 0xff that psql complains about. Maybe that helps to locate the problem. 0xff is an unusual Windows-1252 character as well... Yours, Laurenz Albe From ashish.karalkar@info-spectrum.com Mon Sep 3 12:10:43 2007 Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 2839E9F9557 for ; Mon, 3 Sep 2007 09:10:43 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 36983-01 for ; Mon, 3 Sep 2007 09:10:38 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from pro33.abac.com (pro33.abac.com [66.226.64.34]) by postgresql.org (Postfix) with ESMTP id 9A73E9F954A for ; Mon, 3 Sep 2007 09:10:38 -0300 (ADT) Received: from ashishk ([220.227.213.66]) (authenticated bits=0) by pro33.abac.com (8.14.1/8.14.1) with ESMTP id l83CAHpd009119 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NO); Mon, 3 Sep 2007 05:10:22 -0700 (PDT) (envelope-from ashish.karalkar@info-spectrum.com) Message-ID: <005101c7ee23$6ccb7e50$170211ac@LIONKING.COM> From: "Ashish Karalkar" To: "Albe Laurenz" Cc: References: <001f01c7ee17$e05eb4b0$170211ac@LIONKING.COM> Subject: Re: invalid byte sequence for encoding "UTF8": 0xff Date: Mon, 3 Sep 2007 17:40:20 +0530 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.2180 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/60 X-Sequence-Number: 119984 ----- Original Message ----- From: "Albe Laurenz" To: "Ashish Karalkar *EXTERN*" Cc: Sent: Monday, September 03, 2007 4:54 PM Subject: RE: [GENERAL] invalid byte sequence for encoding "UTF8": 0xff Ashish Karalkar wrote: >>> I have a data script which runs fine from PgAdmin SQL >>> Editor,but when I run this from command prompt I get >>> following error: >>> >>> test=# \i /usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql >>> >>> psql:/usr/local/pgsql/qsweb1/QSWEB_100_4_Default_Data.sql:1: >>> ERROR: invalid byte sequence for encoding "UTF8": 0xff >>> >>> version >>> -------------------------------------------------------------- >>> PostgreSQL 8.2.0 on i686-pc-linux-gnu, compiled by GCC gcc >>> (GCC) 3.4.3 20041212 (Red Hat 3.4.3-9.EL4) >> >> - What is the client operating system (where you run psql and >> PgAdmin III)? >> > Its Windows XP - PgAdmin III > RHEL 3.4.3-9.EL4-psql (Server Machine) So I get it that you run "psql" on Windows XP, right? > PGCLIENTENCODING is not set and as per documantation I > think by default it takes value of database i.e. UTF8 > >> - What does the SQL command "show client_encoding;" return >> when you issue it in >> a) PgAdmin III > UNICODE >> b) psql > UTF8 Ok, I suspect that's your problem. You created QSWEB_100_4_Default_Data.sql by using the "Save" dialog in PgAdmin III on the Windows machine, right? Then the file will probably be encoded in Windows-1252. If your client_encoding is set to UTF8, psql will expect UTF-8 data in the SQL script and complain if it meets wrong ones. Does the script work as expected when you change the client encoding to WIN1252? >> - Please create a file that contains only the first line >> of QSWEB_100_4_Default_Data.sql (I call it "l" in the following >> commands), run the following two (Linux) commands on it: >> a) od -t c l >> b) od -t x1 l >> and show us the output of both commands. > > [root@localhost qsweb]# od -t c test.sql > 0000000 \ s e t O N _ E R R O R _ S T > 0000020 O P > 0000022 > [root@localhost qsweb]# od -t x1 test.sql > 0000000 5c 73 65 74 20 4f 4e 5f 45 52 52 4f 52 5f 53 54 > 0000020 4f 50 > 0000022 That's weird, because psql complained about line 1. Maybe you messed something up by extracting the first line. Try the following: - Use binary file transfer and transfer the SQL script to a Linux machine. - Run "od -t c -t x1" on the file - Find the 0xff that psql complains about. Maybe that helps to locate the problem. 0xff is an unusual Windows-1252 character as well... Hey Thanks Albe it worked. Yours, Laurenz Albe From rummandba@gmail.com Wed May 11 07:16:40 2011 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 589F31337B93 for ; Wed, 11 May 2011 04:16:40 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 64658-10 for ; Wed, 11 May 2011 07:16:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-bw0-f46.google.com (mail-bw0-f46.google.com [209.85.214.46]) by mail.postgresql.org (Postfix) with ESMTP id 241F71337B6E for ; Wed, 11 May 2011 04:16:30 -0300 (ADT) Received: by bwz15 with SMTP id 15so194323bwz.19 for ; Wed, 11 May 2011 00:16:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=krQIOkDeG3d5SXoRW5n4BzOyWssWllYKAYdwunz259o=; b=DCIRA7VXgKXW2YaZz6+9i12pB3iOBn7Ptdv2C9+JcRN9fKM4FjpP07J0naHcqVzzYY m4RC35kcYPmQ8O3Oxm2rZmgCaIkknMS+4ob29wjJFB1VndPuTS1taITwP4vrtAZxMLXc Z3tftGMRdMEc76vn6ZnuZwUraYf881pdqSa5g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=RBmcZw11wd4g9AiihmjTZyCWUnynYNoQ/VA8eUaEPSu3inS64Q13JGwhLjIV0QhLxD fPkXEyl4pqIOGpZXwMkbme2Cepz3NnRvhbpkkwWZqNYe681uF5JQKGVjm0ogEr3YNM1L Z0/QcYQLG8uphor6sNmmUydNgFd2u5DBg8KgE= MIME-Version: 1.0 Received: by 10.204.14.204 with SMTP id h12mr2703697bka.78.1305098190549; Wed, 11 May 2011 00:16:30 -0700 (PDT) Received: by 10.205.83.197 with HTTP; Wed, 11 May 2011 00:16:30 -0700 (PDT) Date: Wed, 11 May 2011 13:16:30 +0600 Message-ID: Subject: invalid byte sequence for encoding "UTF8": 0xf1612220 From: AI Rumman To: pgsql-general General Content-Type: multipart/alternative; boundary=00032555b34e0b72c904a2fadaf9 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.897 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/331 X-Sequence-Number: 175763 --00032555b34e0b72c904a2fadaf9 Content-Type: text/plain; charset=ISO-8859-1 I am trying to migrate a database from Postgresql 8.2 to Postgresql 8.3 and getting the following error: pg_restore: [archiver (db)] Error from TOC entry 2764; 0 29708702 TABLE DATA originaldata postgres pg_restore: [archiver (db)] COPY failed: ERROR: invalid byte sequence for encoding "UTF8": 0xf1612220 HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by "client_encoding". CONTEXT: COPY wi_originaldata, line 3592 I took a dump from 8.2 server and then tried to restore at 8.3. Both the client_encoding and server_encoding are UTF8 at both the servers. Table "public.data" Column | Type | Modifiers ---------------------+------------------------+------------------------------------------------------------------------ orgid | integer | id | integer | not null default nextval(('"data"'::text)::regclass) datatypecode | character varying(15) | batchname | character varying(60) | filename | character varying(60) | encoding | character varying(20) | errormessage | character varying(255) | originaldata_backup | bytea | processeddata | bytea | validatedflag | smallint | processedflag | smallint | createddate | date | createdtime | time without time zone | modifieddate | date | modifiedtime | time without time zone | processeddate | date | processedtime | time without time zone | deletedflag | smallint | originaldata | text | Indexes: "data_pkey" PRIMARY KEY, btree (id) Any help will be appreciable. --00032555b34e0b72c904a2fadaf9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: base64 SSBhbSB0cnlpbmcgdG8gbWlncmF0ZSBhIGRhdGFiYXNlIGZyb20gUG9zdGdyZXNxbCA4LjIgdG8g UG9zdGdyZXNxbCA4LjMgYW5kIGdldHRpbmcgdGhlIGZvbGxvd2luZyBlcnJvcjo8YnI+PGJyPnBn X3Jlc3RvcmU6IFthcmNoaXZlciAoZGIpXSBFcnJvciBmcm9tIFRPQyBlbnRyeSAyNzY0OyAwIDI5 NzA4NzAyIFRBQkxFIERBVEEgb3JpZ2luYWxkYXRhIHBvc3RncmVzPGJyPnBnX3Jlc3RvcmU6IFth cmNoaXZlciAoZGIpXSBDT1BZIGZhaWxlZDogRVJST1I6oCBpbnZhbGlkIGJ5dGUgc2VxdWVuY2Ug Zm9yIGVuY29kaW5nICZxdW90O1VURjgmcXVvdDs6IDB4ZjE2MTIyMjA8YnI+CkhJTlQ6oCBUaGlz IGVycm9yIGNhbiBhbHNvIGhhcHBlbiBpZiB0aGUgYnl0ZSBzZXF1ZW5jZSBkb2VzIG5vdCBtYXRj aCB0aGUgZW5jb2RpbmcgZXhwZWN0ZWQgYnkgdGhlIHNlcnZlciwgd2hpY2ggaXMgY29udHJvbGxl ZCBieSAmcXVvdDtjbGllbnRfZW5jb2RpbmcmcXVvdDsuPGJyPkNPTlRFWFQ6oCBDT1BZIHdpX29y aWdpbmFsZGF0YSwgbGluZSAzNTkyPGJyPjxicj5JIHRvb2sgYSBkdW1wIGZyb20gOC4yIHNlcnZl ciBhbmQgdGhlbiB0cmllZCB0byByZXN0b3JlIGF0IDguMy48YnI+Cjxicj5Cb3RoIHRoZSBjbGll bnRfZW5jb2RpbmcgYW5kIHNlcnZlcl9lbmNvZGluZyBhcmUgVVRGOCBhdCBib3RoIHRoZSBzZXJ2 ZXJzLjxicj48YnI+oKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoCBU YWJsZSAmcXVvdDtwdWJsaWMuZGF0YSZxdW90Ozxicj6goKCgoKAgQ29sdW1uoKCgoKCgoCB8oKCg oKCgoKCgIFR5cGWgoKCgoKCgoKAgfKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoCBNb2Rp ZmllcnOgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgIDxicj4KLS0tLS0tLS0tLS0tLS0t LS0tLS0tKy0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLSstLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS08YnI+oG9yZ2lk oKCgoKCgoKCgoKCgoKAgfCBpbnRlZ2VyoKCgoKCgoKCgoKCgoKCgIHwgPGJyPqBpZKCgoKCgoKCg oKCgoKCgoKCgIHwgaW50ZWdlcqCgoKCgoKCgoKCgoKCgoCB8IG5vdCBudWxsIGRlZmF1bHQgbmV4 dHZhbCgoJiMzOTsmcXVvdDtkYXRhJnF1b3Q7JiMzOTs6OnRleHQpOjpyZWdjbGFzcyk8YnI+CqBk YXRhdHlwZWNvZGWgoKCgoKCgIHwgY2hhcmFjdGVyIHZhcnlpbmcoMTUpoCB8IDxicj6gYmF0Y2hu YW1loKCgoKCgoKCgoCB8IGNoYXJhY3RlciB2YXJ5aW5nKDYwKaAgfCA8YnI+oGZpbGVuYW1loKCg oKCgoKCgoKAgfCBjaGFyYWN0ZXIgdmFyeWluZyg2MCmgIHwgPGJyPqBlbmNvZGluZ6CgoKCgoKCg oKCgIHwgY2hhcmFjdGVyIHZhcnlpbmcoMjApoCB8IDxicj6gZXJyb3JtZXNzYWdloKCgoKCgoCB8 IGNoYXJhY3RlciB2YXJ5aW5nKDI1NSkgfCA8YnI+CqBvcmlnaW5hbGRhdGFfYmFja3VwIHwgYnl0 ZWGgoKCgoKCgoKCgoKCgoKCgoCB8IDxicj6gcHJvY2Vzc2VkZGF0YaCgoKCgoCB8IGJ5dGVhoKCg oKCgoKCgoKCgoKCgoKAgfCA8YnI+oHZhbGlkYXRlZGZsYWegoKCgoKAgfCBzbWFsbGludKCgoKCg oKCgoKCgoKCgIHwgPGJyPqBwcm9jZXNzZWRmbGFnoKCgoKCgIHwgc21hbGxpbnSgoKCgoKCgoKCg oKCgoCB8IDxicj6gY3JlYXRlZGRhdGWgoKCgoKCgoCB8IGRhdGWgoKCgoKCgoKCgoKCgoKCgoKAg fCA8YnI+CqBjcmVhdGVkdGltZaCgoKCgoKCgIHwgdGltZSB3aXRob3V0IHRpbWUgem9uZSB8IDxi cj6gbW9kaWZpZWRkYXRloKCgoKCgoCB8IGRhdGWgoKCgoKCgoKCgoKCgoKCgoKAgfCA8YnI+oG1v ZGlmaWVkdGltZaCgoKCgoKAgfCB0aW1lIHdpdGhvdXQgdGltZSB6b25lIHwgPGJyPqBwcm9jZXNz ZWRkYXRloKCgoKCgIHwgZGF0ZaCgoKCgoKCgoKCgoKCgoKCgoCB8IDxicj6gcHJvY2Vzc2VkdGlt ZaCgoKCgoCB8IHRpbWUgd2l0aG91dCB0aW1lIHpvbmUgfCA8YnI+CqBkZWxldGVkZmxhZ6CgoKCg oKCgIHwgc21hbGxpbnSgoKCgoKCgoKCgoKCgoCB8IDxicj6gb3JpZ2luYWxkYXRhoKCgoKCgoCB8 IHRleHSgoKCgoKCgoKCgoKCgoKCgoKAgfCA8YnI+SW5kZXhlczo8YnI+oKCgICZxdW90O2RhdGFf cGtleSZxdW90OyBQUklNQVJZIEtFWSwgYnRyZWUgKGlkKTxicj48YnI+QW55IGhlbHAgd2lsbCBi ZSBhcHByZWNpYWJsZS48YnI+PGJyPjxicj4K --00032555b34e0b72c904a2fadaf9-- From craig@postnewspapers.com.au Thu May 12 02:52:39 2011 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 182E31337B69 for ; Wed, 11 May 2011 23:52:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 41974-02 for ; Thu, 12 May 2011 02:52:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from www.postnewspapers.com.au (www.postnewspapers.com.au [173.230.139.50]) by mail.postgresql.org (Postfix) with ESMTP id 247CF133740B for ; Wed, 11 May 2011 23:52:32 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by www.postnewspapers.com.au (Postfix) with ESMTP id F2B4D10D; Wed, 11 May 2011 22:52:32 -0400 (EDT) X-Virus-Scanned: amavisd-new at postnewspapers.com.au.com Received: from www.postnewspapers.com.au ([127.0.0.1]) by localhost (www.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id T+m+Xn0oP1kT; Wed, 11 May 2011 22:52:32 -0400 (EDT) Received: from mail.postnewspapers.com.au (ppp171-128.static.internode.on.net [150.101.171.128]) by www.postnewspapers.com.au (Postfix) with ESMTP id 2D8652D; Wed, 11 May 2011 22:52:32 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.postnewspapers.com.au (Postfix) with ESMTP id E73E0AED6F; Thu, 12 May 2011 10:52:30 +0800 (WST) X-Virus-Scanned: Debian amavisd-new at postnewspapers.com.au Received: from mail.postnewspapers.com.au ([127.0.0.1]) by localhost (mail.postnewspapers.com.au [127.0.0.1]) (amavisd-new, port 10024) with LMTP id fwBZAgCik0u9; Thu, 12 May 2011 10:52:26 +0800 (WST) Received: from [10.1.1.5] (124-169-254-58.dyn.iinet.net.au [124.169.254.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "Craig Ringer", Issuer "POST Certificate Authority" (verified OK)) by mail.postnewspapers.com.au (Postfix) with ESMTPSA id BD013AED6E; Thu, 12 May 2011 10:52:25 +0800 (WST) Message-ID: <4DCB4B68.1070102@postnewspapers.com.au> Date: Thu, 12 May 2011 10:52:24 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Thunderbird/3.1.10 MIME-Version: 1.0 To: AI Rumman CC: pgsql-general General Subject: Re: invalid byte sequence for encoding "UTF8": 0xf1612220 References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201105/375 X-Sequence-Number: 175807 On 05/11/2011 03:16 PM, AI Rumman wrote: > I am trying to migrate a database from Postgresql 8.2 to Postgresql 8.3 > and getting the following error: > > pg_restore: [archiver (db)] Error from TOC entry 2764; 0 29708702 TABLE > DATA originaldata postgres > pg_restore: [archiver (db)] COPY failed: ERROR: invalid byte sequence > for encoding "UTF8": 0xf1612220 > HINT: This error can also happen if the byte sequence does not match > the encoding expected by the server, which is controlled by > "client_encoding". > CONTEXT: COPY wi_originaldata, line 3592 > > I took a dump from 8.2 server and then tried to restore at 8.3. > > Both the client_encoding and server_encoding are UTF8 at both the servers. Newer versions of Pg got better at caching bad unicode. While this helps prevent bad data getting into the database, it's a right pain if you're moving data over from an older version with less strict checks. I don't know of any way to relax the checks for the purpose of importing dumps. You'll need to fix your dump files before loading them (by finding the faulty text and fixing it) or fix it in the origin database before migrating the data. Neither approach is nice or easy, but nobody has yet stepped up to write a unicode verifier tool that checks old databases' text fields against stricter rules... -- Craig Ringer From cedric.villemain.debian@gmail.com Thu May 12 08:33:19 2011 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 673101337BD0 for ; Thu, 12 May 2011 05:33:19 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 82885-10 for ; Thu, 12 May 2011 08:33:11 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-qw0-f46.google.com (mail-qw0-f46.google.com [209.85.216.46]) by mail.postgresql.org (Postfix) with ESMTP id 85FE91337BBA for ; Thu, 12 May 2011 05:33:11 -0300 (ADT) Received: by qwk3 with SMTP id 3so655012qwk.19 for ; Thu, 12 May 2011 01:33:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=yMBlaJG/VEh9hgpiGD3tIrfl6jRB4fZaXx7pkomHmcg=; b=HNACNSlxH9gu5Sa0E7RgW1Jbc1vRe1leucS/+CqtdEqDftx57iNP0xIn8imOS6w1Wq bu9Zf6S5kVq87icuZ9CfkHvYsORjNGUueNrYfCg+R5kPi6EaJpKaZrY6rzvGv7678oji ptD7KRqDX54tTsfipqwMeCszrdH+2et+TDEq0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=gnTk/dMenmOuJYVqhdrAxXSGL4N1e/IXRiGaPp/30agz4eJG+zotx/jTDb/oSt8411 14RnU0/nL2HujfXcZfT8O8Slwe5An7PHMzlkg3ZHcip2RebFfm36Rk8AI2S43MWiD7VP GFF/Pb81AYlQ5SqFSKXLMwLs39oRrvW3ci+6w= Received: by 10.229.64.84 with SMTP id d20mr7916141qci.206.1305189190204; Thu, 12 May 2011 01:33:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.84.16 with HTTP; Thu, 12 May 2011 01:32:50 -0700 (PDT) In-Reply-To: <4DCB4B68.1070102@postnewspapers.com.au> References: <4DCB4B68.1070102@postnewspapers.com.au> From: =?ISO-8859-1?Q?C=E9dric_Villemain?= Date: Thu, 12 May 2011 10:32:50 +0200 Message-ID: Subject: Re: invalid byte sequence for encoding "UTF8": 0xf1612220 To: Craig Ringer Cc: AI Rumman , pgsql-general General Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.898 tagged_above=-5 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001 X-Spam-Level: X-Archive-Number: 201105/381 X-Sequence-Number: 175813 2011/5/12 Craig Ringer : > On 05/11/2011 03:16 PM, AI Rumman wrote: >> >> I am trying to migrate a database from Postgresql 8.2 to Postgresql 8.3 >> and getting the following error: >> >> pg_restore: [archiver (db)] Error from TOC entry 2764; 0 29708702 TABLE >> DATA originaldata postgres >> pg_restore: [archiver (db)] COPY failed: ERROR: =A0invalid byte sequence >> for encoding "UTF8": 0xf1612220 >> HINT: =A0This error can also happen if the byte sequence does not match >> the encoding expected by the server, which is controlled by >> "client_encoding". >> CONTEXT: =A0COPY wi_originaldata, line 3592 >> >> I took a dump from 8.2 server and then tried to restore at 8.3. >> >> Both the client_encoding and server_encoding are UTF8 at both the server= s. > > Newer versions of Pg got better at caching bad unicode. While this helps > prevent bad data getting into the database, it's a right pain if you're > moving data over from an older version with less strict checks. > > I don't know of any way to relax the checks for the purpose of importing > dumps. You'll need to fix your dump files before loading them (by finding > the faulty text and fixing it) or fix it in the origin database before > migrating the data. Neither approach is nice or easy, but nobody has yet > stepped up to write a unicode verifier tool that checks old databases' te= xt > fields against stricter rules... The 2 following articles have SQL functions and documentation you may find useful: http://tapoueh.org/articles/blog/_Getting_out_of_SQL_ASCII,_part_1.html http://tapoueh.org/articles/blog/_Getting_out_of_SQL_ASCII,_part_2.html > > -- > Craig Ringer > > -- > Sent via pgsql-general mailing list (pgsql-general@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-general > --=20 C=E9dric Villemain=A0 =A0 =A0 =A0 =A0 =A0 =A0=A0 2ndQuadrant http://2ndQuadrant.fr/=A0 =A0=A0 PostgreSQL : Expertise, Formation et Suppo= rt From Michael.BRUSSER@3ds.com Wed Jun 15 21:03:51 2011 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 30AC5B5D95B for ; Wed, 15 Jun 2011 18:03:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 21148-02 for ; Wed, 15 Jun 2011 21:03:44 +0000 (UTC) X-Greylist: delayed 00:45:11.319895 by SQLgrey-1.7.6 Received: from cluster-b.mailcontrol.com (cluster-b.mailcontrol.com [85.115.56.190]) by mail.postgresql.org (Postfix) with ESMTP id 94D21B5D803 for ; Wed, 15 Jun 2011 18:03:43 -0300 (ADT) Received: from ag-outbound.3ds.com (ag-outbound.3ds.com [91.103.41.254]) by rly18b.srv.mailcontrol.com (MailControl) with ESMTP id p5FKISHQ015327 for ; Wed, 15 Jun 2011 21:18:28 +0100 Received: from AG-DCC-MBX03.dsone.3ds.com ([169.254.3.213]) by AG-DCC-HUB02.dsone.3ds.com ([10.20.115.32]) with mapi id 14.01.0289.008; Wed, 15 Jun 2011 16:18:28 -0400 From: BRUSSER Michael To: "pgsql-general@postgresql.org" Subject: Invalid byte sequence for encoding "UTF8": 0xedbebf Thread-Topic: Invalid byte sequence for encoding "UTF8": 0xedbebf Thread-Index: AcwrmWBB80toV8KrTEeGUg/V0EViDg== Date: Wed, 15 Jun 2011 20:18:27 +0000 Message-ID: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686@AG-DCC-MBX03.dsone.3ds.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.17.143] Content-Type: multipart/alternative; boundary="_000_29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686AGDCCMBX03dsone_" MIME-Version: 1.0 X-Scanned-By: MailControl A-10-80-00 (www.mailcontrol.com) on 10.66.0.128 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-5 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201106/404 X-Sequence-Number: 176837 --_000_29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686AGDCCMBX03dsone_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This is a follow-up on my previous message http://archives.postgresql.org/p= gsql-general/2011-06/msg00054.php I think I have now some understanding of what's causing the problem, but I = don't have a good solution, instead more questions. The release notes for v8.1 at http://www.postgresql.org/docs/current/intera= ctive/release-8-1.html make a good suggestion on using iconv to convert the plain-text dump file i= nto utf8 On Linux this did not work, the input and output file were identical. The i= conv on Solaris refused to open the input file (probably too big), although it worked with a chunk of it and reported con= version error. Unless there's no other options I don't want to use sed or break file into = pieces, if possible, I would prefer to identify the bad records on the data= base. I tried SELECT with everything I could think of: ~*, SIMILAR TO, and the = likes of them, but I never got it right. Is there a way to find the records with the text field containing Unicode b= ytes "0xedbebf"? Unfortunately this is a very old version 7.3.10 Thank you. Michael. This email and any attachments are intended solely for the use of the indiv= idual or entity to whom it is addressed and may be confidential and/or priv= ileged. If you are not one of the named recipients or have received this email in e= rror, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this em= ail and all attachments, (iii) Dassault Systemes does not accept or assume any liability or responsi= bility for any use of or reliance on this email. For other languages, go to http://www.3ds.com/terms/email-disclaimer --_000_29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686AGDCCMBX03dsone_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

This is a follow-up on my previous message http://archives.postgresql.org/pgsql-general/2011-06/msg00054.php

 

I think I have now some understanding of what’= s causing the problem, but I don’t have a good solution, instead more= questions.

The release notes for v8.1 at http://www.postgresql.org/docs/current/interactive/release-8-1.html

make a good suggestion on using iconv to convert the= plain-text dump file into utf8

On Linux this did not work, the input and output fil= e were identical. The iconv on Solaris  refused to open the input file=

(probably too big),  although it worked with a = chunk of it and reported conversion error.

 

Unless there’s no other options I don’t = want to use sed or break file into pieces, if possible, I would prefer to i= dentify the bad records on the database. 

I tried SELECT with everything  I could think o= f:  ~*, SIMILAR TO, and the likes of them, but I never got it right.

 

Is there a way to find the records with the text fie= ld containing Unicode bytes “0xedbebf”?

Unfortunately this is a very old version 7.3.10

 

Thank you.

Michael.

This email and any attachments are intended solely for the use of the indiv= idual or entity to whom it is addressed and may be confidential and/or priv= ileged.

If you are not one of the named recipients or have received this email in e= rror,

(i) you should not read, disclose, or copy it,

(ii) please notify sender of your receipt by reply email and delete this em= ail and all attachments,

(iii) Dassault Systemes does not accept or assume any liability or responsi= bility for any use of or reliance on this email.

For other languages, go to http://www.3ds.com/terms/email-disclaimer

--_000_29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686AGDCCMBX03dsone_-- From ahodgson@simkin.ca Wed Jun 15 21:37:33 2011 Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 3143CB5DBC9 for ; Wed, 15 Jun 2011 18:37:33 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 46088-03 for ; Wed, 15 Jun 2011 21:37:27 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from zeus.simkin.ca (zeus.simkin.ca [72.51.27.124]) by mail.postgresql.org (Postfix) with ESMTP id 10FFDB5DBCE for ; Wed, 15 Jun 2011 18:37:26 -0300 (ADT) Received: from pc-1072.reinvent.com (office.reinvent.com [72.51.27.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by zeus.simkin.ca (Postfix) with ESMTPSA id BB0CC270195 for ; Wed, 15 Jun 2011 14:37:24 -0700 (PDT) From: Alan Hodgson Organization: Simkin Network Consulting To: pgsql-general@postgresql.org Subject: Re: Invalid byte sequence for encoding "UTF8": 0xedbebf Date: Wed, 15 Jun 2011 14:37:21 -0700 User-Agent: KMail/1.13.6 (Linux/2.6.38-8-generic; KDE/4.6.2; x86_64; ; ) References: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686@AG-DCC-MBX03.dsone.3ds.com> In-Reply-To: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686@AG-DCC-MBX03.dsone.3ds.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201106151437.21275.ahodgson@simkin.ca> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201106/405 X-Sequence-Number: 176838 On June 15, 2011 01:18:27 PM BRUSSER Michael wrote: > Unless there's no other options I don't want to use sed or break file into > pieces, if possible, iconv loads everything into RAM. You can use "split", convert the pieces, and then recombine, I did that when converting a large database to utf-8 and it worked. -- Obama has now fired more cruise missiles than all other Nobel Peace prize winners combined. From Michael.BRUSSER@3ds.com Wed Jun 15 21:45:25 2011 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id C00E0B5DBD9 for ; Wed, 15 Jun 2011 18:45:25 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 33300-05 for ; Wed, 15 Jun 2011 21:45:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cluster-b.mailcontrol.com (cluster-b.mailcontrol.com [85.115.56.190]) by mail.postgresql.org (Postfix) with ESMTP id 46A40B5DBC9 for ; Wed, 15 Jun 2011 18:45:19 -0300 (ADT) Received: from rly08b.srv.mailcontrol.com (localhost.localdomain [127.0.0.1]) by rly08b.srv.mailcontrol.com (MailControl) with ESMTP id p5FLj9wu008259 for ; Wed, 15 Jun 2011 22:45:17 +0100 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by rly08b.srv.mailcontrol.com (MailControl) id p5FLiBSG000683 for ; Wed, 15 Jun 2011 22:44:11 +0100 Received: from ag-outbound.3ds.com (ag-outbound.3ds.com [91.103.41.254]) by rly08b-eth0.srv.mailcontrol.com (envelope-sender ) (MIMEDefang) with ESMTP id p5FLiA7K000421; Wed, 15 Jun 2011 22:44:11 +0100 (BST) Received: from AG-DCC-MBX03.dsone.3ds.com ([169.254.3.213]) by AG-DCC-HUB01.dsone.3ds.com ([10.20.115.31]) with mapi id 14.01.0289.008; Wed, 15 Jun 2011 17:44:11 -0400 From: BRUSSER Michael To: Alan Hodgson , "pgsql-general@postgresql.org" Subject: Re: Invalid byte sequence for encoding "UTF8": 0xedbebf Thread-Topic: [GENERAL] Invalid byte sequence for encoding "UTF8": 0xedbebf Thread-Index: AcwrmWBB80toV8KrTEeGUg/V0EViDgALI8KAAAhMdnA= Date: Wed, 15 Jun 2011 21:44:10 +0000 Message-ID: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2733@AG-DCC-MBX03.dsone.3ds.com> References: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686@AG-DCC-MBX03.dsone.3ds.com> <201106151437.21275.ahodgson@simkin.ca> In-Reply-To: <201106151437.21275.ahodgson@simkin.ca> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.17.143] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Scanned-By: MailControl A-10-80-00 (www.mailcontrol.com) on 10.66.1.118 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/406 X-Sequence-Number: 176839 -----Original Message----- From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgr= esql.org] On Behalf Of Alan Hodgson Sent: Wednesday, June 15, 2011 5:37 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] Invalid byte sequence for encoding "UTF8": 0xedbebf On June 15, 2011 01:18:27 PM BRUSSER Michael wrote: > Unless there's no other options I don't want to use sed or break file int= o > pieces, if possible, -------------------------------------------------- >> iconv loads everything into RAM. You can use "split", convert the pieces= , and >> then recombine, I did that when converting a large database to utf-8 and= it >> worked. ------------------------------------------------- - Thanks, but this is exactly what I am trying to avoid! Using split is good if you have one database to upgrade and no external cus= tomers. (Not to mention other problems with this approach) This email and any attachments are intended solely for the use of the indiv= idual or entity to whom it is addressed and may be confidential and/or priv= ileged. If you are not one of the named recipients or have received this email in e= rror, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this em= ail and all attachments, (iii) Dassault Systemes does not accept or assume any liability or responsi= bility for any use of or reliance on this email. For other languages, go to http://www.3ds.com/terms/email-disclaimer From laurenz.albe@wien.gv.at Thu Jun 16 09:15:48 2011 Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 294EAB5D944 for ; Thu, 16 Jun 2011 06:15:48 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 73275-05 for ; Thu, 16 Jun 2011 09:15:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay-fr112.magwien.gv.at (relay-fr112.magwien.gv.at [217.149.225.66]) by mail.postgresql.org (Postfix) with ESMTP id 7E123B5D8BD for ; Thu, 16 Jun 2011 06:15:41 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by relay-fr112.magwien.gv.at (Postfix) with ESMTP id 6CC5E4C59C6; Thu, 16 Jun 2011 11:15:40 +0200 (CEST) X-Virus-Scanned: by amavisd-new using Sophie and ClamAV at magwien.gv.at Received: from exrat0.host.magwien.gv.at (exrat0.host.magwien.gv.at [10.153.17.24]) by relay-fr112.magwien.gv.at (Postfix) with ESMTP id 4DFC04C5A54; Thu, 16 Jun 2011 11:15:40 +0200 (CEST) Received: from exadv11.host.magwien.gv.at ([10.153.17.1]) by exrat0.host.magwien.gv.at with Microsoft SMTPSVC(6.0.3790.4675); Thu, 16 Jun 2011 11:15:39 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Invalid byte sequence for encoding "UTF8": 0xedbebf Date: Thu, 16 Jun 2011 11:15:38 +0200 Message-ID: In-Reply-To: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686@AG-DCC-MBX03.dsone.3ds.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [GENERAL] Invalid byte sequence for encoding "UTF8": 0xedbebf thread-index: AcwrmWBB80toV8KrTEeGUg/V0EViDgAa2FQQ References: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686@AG-DCC-MBX03.dsone.3ds.com> From: "Albe Laurenz" To: "BRUSSER Michael *EXTERN*" , X-OriginalArrivalTime: 16 Jun 2011 09:15:39.0825 (UTC) FILETIME=[F5DCD210:01CC2C05] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/435 X-Sequence-Number: 176868 BRUSSER Michael wrote: > Is there a way to find the records with the text field containing Unicode bytes "0xedbebf"? > > Unfortunately this is a very old version 7.3.10 This should work on 7.3 (according to the documentation): SELECT id FROM nlsdata WHERE position('\360\235\204\236'::bytea IN val::bytea) =3D 1; Here "val" is the column containing the values in question. Yours, Laurenz Albe From Michael.BRUSSER@3ds.com Thu Jun 16 17:34:39 2011 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 1665EB5DC12 for ; Thu, 16 Jun 2011 14:34:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 38647-01 for ; Thu, 16 Jun 2011 17:34:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from cluster-b.mailcontrol.com (cluster-b.mailcontrol.com [85.115.56.190]) by mail.postgresql.org (Postfix) with ESMTP id 39229B5DBC5 for ; Thu, 16 Jun 2011 14:34:32 -0300 (ADT) Received: from rly18b.srv.mailcontrol.com (localhost.localdomain [127.0.0.1]) by rly18b.srv.mailcontrol.com (MailControl) with ESMTP id p5GHYUot030511 for ; Thu, 16 Jun 2011 18:34:30 +0100 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by rly18b.srv.mailcontrol.com (MailControl) id p5GHXnsv024237 for ; Thu, 16 Jun 2011 18:33:49 +0100 Received: from ag-outbound.3ds.com (ag-outbound.3ds.com [91.103.41.254]) by rly18b-eth0.srv.mailcontrol.com (envelope-sender ) (MIMEDefang) with ESMTP id p5GHWuMF019814; Thu, 16 Jun 2011 18:33:49 +0100 (BST) Received: from AG-DCC-MBX03.dsone.3ds.com ([169.254.3.213]) by AG-DCC-HUB02.dsone.3ds.com ([10.20.115.32]) with mapi id 14.01.0289.008; Thu, 16 Jun 2011 13:32:58 -0400 From: BRUSSER Michael To: Albe Laurenz , "pgsql-general@postgresql.org" Subject: Re: Invalid byte sequence for encoding "UTF8": 0xedbebf Thread-Topic: [GENERAL] Invalid byte sequence for encoding "UTF8": 0xedbebf Thread-Index: AcwrmWBB80toV8KrTEeGUg/V0EViDgAa2FQQABCMfVA= Date: Thu, 16 Jun 2011 17:32:57 +0000 Message-ID: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2D47@AG-DCC-MBX03.dsone.3ds.com> References: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686@AG-DCC-MBX03.dsone.3ds.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.1.17.143] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Scanned-By: MailControl A-10-80-00 (www.mailcontrol.com) on 10.66.1.128 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/465 X-Sequence-Number: 176898 -----Original Message----- From: Albe Laurenz [mailto:laurenz.albe@wien.gv.at] Sent: Thursday, June 16, 2011 5:16 AM To: BRUSSER Michael; pgsql-general@postgresql.org Subject: RE: [GENERAL] Invalid byte sequence for encoding "UTF8": 0xedbebf BRUSSER Michael wrote: > Is there a way to find the records with the text field containing Unicode= bytes "0xedbebf"? > Unfortunately this is a very old version 7.3.10 This should work on 7.3 (according to the documentation): SELECT id FROM nlsdata WHERE position('\360\235\204\236'::bytea IN val::byt= ea) =3D 1; ---------------------------------------------------------------------------= ----- Albe, thanks for pointing this out! I made a minor change, added decode since text cannot be cast to bytea and = tried something like this: SELECT id FROM myTable WHERE position('\360\235\204\236'::bytea IN decode= (myTextField, 'escape')) !=3D 0 ERROR: decode: Bad input string for type bytea If I limit query to some healthy records - " AND id between 100 and 110" it= works and returns empty result. So the problem now is that without decode myTextField cannot be converted t= o bytea, with decode it breaks on the first 'bad' value. Maybe this explains why? testdb=3D# select decode('\360\235\204\236'::text, 'escape'); ERROR: Unicode >=3D 0x10000 is not supported Another thought is that if I get this to work I may need to search for anyt= hing outside of the standard utf range, rather than any specific sequence. I am beginning to understand why many pe= ople dealt with this in the dump file, but I'm not ready to give up yet... As usual, any ideas are appreciated! Thanks. This email and any attachments are intended solely for the use of the indiv= idual or entity to whom it is addressed and may be confidential and/or priv= ileged. If you are not one of the named recipients or have received this email in e= rror, (i) you should not read, disclose, or copy it, (ii) please notify sender of your receipt by reply email and delete this em= ail and all attachments, (iii) Dassault Systemes does not accept or assume any liability or responsi= bility for any use of or reliance on this email. For other languages, go to http://www.3ds.com/terms/email-disclaimer From laurenz.albe@wien.gv.at Fri Jun 17 07:59:24 2011 Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 5254CB5DBC1 for ; Fri, 17 Jun 2011 04:59:24 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 92690-01 for ; Fri, 17 Jun 2011 07:59:18 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from relay-fr112.magwien.gv.at (relay-fr112.magwien.gv.at [217.149.225.66]) by mail.postgresql.org (Postfix) with ESMTP id 0B2CDB5DBC5 for ; Fri, 17 Jun 2011 04:59:18 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by relay-fr112.magwien.gv.at (Postfix) with ESMTP id AABA94C5A85; Fri, 17 Jun 2011 09:59:17 +0200 (CEST) X-Virus-Scanned: by amavisd-new using Sophie and ClamAV at magwien.gv.at Received: from exrat0.host.magwien.gv.at (exrat0.host.magwien.gv.at [10.153.17.24]) by relay-fr112.magwien.gv.at (Postfix) with ESMTP id 8BB014C5A86; Fri, 17 Jun 2011 09:59:17 +0200 (CEST) Received: from exadv11.host.magwien.gv.at ([10.153.17.1]) by exrat0.host.magwien.gv.at with Microsoft SMTPSVC(6.0.3790.4675); Fri, 17 Jun 2011 09:58:58 +0200 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Re: Invalid byte sequence for encoding "UTF8": 0xedbebf Date: Fri, 17 Jun 2011 09:58:57 +0200 Message-ID: In-Reply-To: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2D47@AG-DCC-MBX03.dsone.3ds.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [GENERAL] Invalid byte sequence for encoding "UTF8": 0xedbebf thread-index: AcwrmWBB80toV8KrTEeGUg/V0EViDgAa2FQQABCMfVAAHtO/MA== References: <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2686@AG-DCC-MBX03.dsone.3ds.com> <29EA9BFEF7E7FC4F988818CA0C5C78C20F6A2D47@AG-DCC-MBX03.dsone.3ds.com> From: "Albe Laurenz" To: "BRUSSER Michael *EXTERN*" , X-OriginalArrivalTime: 17 Jun 2011 07:58:58.0711 (UTC) FILETIME=[69CC4A70:01CC2CC4] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/496 X-Sequence-Number: 176929 BRUSSER Michael wrote: >>> Is there a way to find the records with the text field containing Unicode bytes "0xedbebf"? >>> Unfortunately this is a very old version 7.3.10 >> >> This should work on 7.3 (according to the documentation): >> SELECT id FROM nlsdata WHERE position('\360\235\204\236'::bytea IN val::bytea) =3D 1; > Albe, thanks for pointing this out! > I made a minor change, added decode since text cannot be cast to bytea and tried something like this: > SELECT id FROM myTable WHERE position('\360\235\204\236'::bytea IN decode(myTextField, 'escape')) !=3D0 > ERROR: decode: Bad input string for type bytea Hrm. I didn't know that there was no cast from text to bytea in 7.3. > Maybe this explains why? > testdb=3D# select decode('\360\235\204\236'::text, 'escape'); > ERROR: Unicode >=3D 0x10000 is not supported No, that is an error on my side. I gave you the wrong byte sequence. For "0xedbebf" you should actually write '\355\276\277'. But that's no valid UTF-8 sequence. > but I'm not ready to give up yet... If you know the byte sequence that causes trouble, you could also use something like "sed" to search and replace it in the dump file. Or (if there are not too many) you could search for the pattern and identify the rows in the database. Then you know which database rows to update. Yours, Laurenz Albe From kukismen@gmail.com Sat Nov 19 17:32:26 2011 Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 5A28190656E for ; Sat, 19 Nov 2011 13:32:26 -0400 (AST) Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RRom9-0002Ff-N7 for pgsql-general@postgresql.org; Sat, 19 Nov 2011 17:32:26 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1RRolw-00027Y-EB for pgsql-general@postgresql.org; Sat, 19 Nov 2011 09:32:12 -0800 Date: Sat, 19 Nov 2011 09:32:12 -0800 (PST) From: pawel_kukawski To: pgsql-general@postgresql.org Message-ID: <1321723932432-5007173.post@n5.nabble.com> Subject: invalid byte sequence for encoding "UTF8": 0x00 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Archive-Number: 201111/742 X-Sequence-Number: 182312 Hi, Is there any way I can store NULL character (\u0000) in string ? Or there is only one option that I have change every text field to bytea. Regards, Pawe=C5=82 -- View this message in context: http://postgresql.1045698.n5.nabble.com/inval= id-byte-sequence-for-encoding-UTF8-0x00-tp5007173p5007173.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. From depesz@depesz.com Sun Nov 20 10:19:29 2011 Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 363B7723ED9 for ; Sun, 20 Nov 2011 06:19:29 -0400 (AST) Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RS4Uj-0004QO-4H for pgsql-general@postgresql.org; Sun, 20 Nov 2011 10:19:29 +0000 Received: from andy.depesz.com ([88.198.47.100] helo=depesz.com) by depesz.com with esmtpa (Exim 4.77) (envelope-from ) id 1RS4UV-0005at-SZ; Sun, 20 Nov 2011 11:19:16 +0100 Date: Sun, 20 Nov 2011 11:19:15 +0100 From: hubert depesz lubaczewski To: pawel_kukawski Cc: pgsql-general@postgresql.org Subject: Re: invalid byte sequence for encoding "UTF8": 0x00 Message-ID: <20111120101915.GA10708@depesz.com> Reply-To: depesz@depesz.com References: <1321723932432-5007173.post@n5.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1321723932432-5007173.post@n5.nabble.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Archive-Number: 201111/784 X-Sequence-Number: 182354 On Sat, Nov 19, 2011 at 09:32:12AM -0800, pawel_kukawski wrote: > Is there any way I can store NULL character (\u0000) in string ? > > Or there is only one option that I have change every text field to bytea. correct question is: why do you want to store \u0000 in text field? Best regards, depesz -- The best thing about modern society is how easy it is to avoid contact with it. http://depesz.com/ From Kris.Olson@dri.edu Thu Apr 26 19:31:24 2018 Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fC2FR-0005jq-6i for pgsql-general@arkaria.postgresql.org; Fri, 27 Apr 2018 12:13:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fC2FP-0008FZ-IZ for pgsql-general@arkaria.postgresql.org; Fri, 27 Apr 2018 12:13:07 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBmc6-00047W-Qz for pgsql-general@lists.postgresql.org; Thu, 26 Apr 2018 19:31:30 +0000 Received: from ex-reno-ht1-x.dri.edu ([134.197.190.81] helo=owa.dri.edu) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fBmc3-0002Uw-Jx for pgsql-general@postgresql.org; Thu, 26 Apr 2018 19:31:29 +0000 Received: from EX-RENO-MB1.DRI.local ([fe80::15e5:8950:a324:886c]) by Ex-Reno-HT1.DRI.local ([::1]) with mapi id 14.03.0382.000; Thu, 26 Apr 2018 12:31:26 -0700 From: Kris Olson To: "pgsql-general@postgresql.org" Subject: invalid byte sequence for encoding "UTF8": 0xff Thread-Topic: invalid byte sequence for encoding "UTF8": 0xff Thread-Index: AdPdlQNuso77MRW+QOOiJDXkcpykUg== Date: Thu, 26 Apr 2018 19:31:24 +0000 Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.15.10.36] Content-Type: multipart/alternative; boundary="_000_F6889FA3C8AA6D40AF5F5215402D9E2384EFEAExRenoMB1DRIlocal_" MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --_000_F6889FA3C8AA6D40AF5F5215402D9E2384EFEAExRenoMB1DRIlocal_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I just did this on all my import dump files: perl -p -i -e 's/\xff//g' *.dump Kris PUBLIC RECORDS NOTICE: In accordance with NRS Chapter 239, this email and r= esponses, unless otherwise made confidential by law, may be subject to the = Nevada Public Records laws and may be disclosed to the public upon request. --_000_F6889FA3C8AA6D40AF5F5215402D9E2384EFEAExRenoMB1DRIlocal_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

I just did this on all my import dump files:

 

perl -p -i -e 's/\xff//g' *.dump

 

Kris


PUBLIC RECORDS NOTICE: In accordance with N= RS Chapter 239, this email and responses, unless otherwise made confidentia= l by law, may be subject to the Nevada Public Records laws and may be discl= osed to the public upon request. --_000_F6889FA3C8AA6D40AF5F5215402D9E2384EFEAExRenoMB1DRIlocal_--