From imartinez@vectorsf.com Mon Mar 22 08:48:51 2010 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 3FFFE633197 for ; Mon, 22 Mar 2010 05:48:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 28540-06 for ; Mon, 22 Mar 2010 08:48:40 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hermes.vectorsf.com (firewall.vectorsf.com [62.82.80.62]) by mail.postgresql.org (Postfix) with ESMTP id 66F34632DF6 for ; Mon, 22 Mar 2010 05:48:40 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by hermes.vectorsf.com (Postfix) with ESMTP id 6970111C0047 for ; Mon, 22 Mar 2010 09:48:36 +0100 (CET) X-Virus-Scanned: amavisd-new at hermes.vectorsf.com Received: from hermes.vectorsf.com ([127.0.0.1]) by localhost (hermes.vectorsf.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ji3iZimecYRS for ; Mon, 22 Mar 2010 09:48:31 +0100 (CET) Received: from hermes.vectorsf.com (hermes.vectorsf.com [10.70.4.30]) by hermes.vectorsf.com (Postfix) with ESMTP id 3523E11C0012 for ; Mon, 22 Mar 2010 09:48:31 +0100 (CET) From: =?iso-8859-1?Q?I=F1igo_Martinez_Lasala?= To: Subject: Bad encoded chars in being inserted into database Date: Mon, 22 Mar 2010 09:48:31 +0100 (CET) Message-ID: <050f01cac99c$7dafe100$790fa300$@com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0510_01CAC9A4.DF744900" X-Mailer: Microsoft Office Outlook 12.0 X-Mailer: Zimbra 5.0.20_GA_3127.RHEL4_64 (ZimbraConnectorForOutlook/5.0.3191.20) Content-Language: es Thread-Index: AcrJnH1ewzMtxpQ8RNe8stLAPzTRcg== X-Originating-IP: [10.70.7.99] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.184 tagged_above=-10 required=5 tests=BAYES_40=-0.185, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201003/147 X-Sequence-Number: 33946 This is a multi-part message in MIME format. ------=_NextPart_000_0510_01CAC9A4.DF744900 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 8bit Hi everybody. I have a doubt about how postgres deal with bad encoded characters into database. We have several gforge application. They are using postgres as database. If we export a database and import again, we have to deal with several bad encoded chars. These bad chars always come from copy & paste emails from Lotus Notes mail client. OK, I understand the Notes client people is using is an ancient application and does not deal very well with some Unicode chars… What I cannot understand is why postgres accept these bad enconded characters into database, exports them without problema but does not allow them when importing again. This has been happening since postgers 7.3. However, until 7.4.XX (y don’t remember what minor version) you could import database without ERRORs. However, since 7.4.XX it’s impossible and it’s imperative to clean bad characters (using iconv, for example) prior importing tables. I agree with this postgres policy, but what I don’t is that you can INSERT them via application. That is, no bad characters should be inserted into database. The check should be made for both import and insert procedures so no bad chars would appear into database. Any suggestion / appreciation about this? We are using php4/5-pgsql module from several distros (CentOS 4/5, debian 4/5 and Ubuntu 8.04LTS) so I discard a pgsql problem and anyway database should deal with this… ------=_NextPart_000_0510_01CAC9A4.DF744900 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi everybody.

 

I have a doubt about how postgres deal with bad = encoded characters into database.

We have several gforge application. They are using = postgres as database.

If we export a database and import again, we have = to deal with several bad encoded chars. These bad chars always come from copy = & paste emails from Lotus Notes mail client. OK, I understand the Notes = client people is using is an ancient application and does not deal very well = with some Unicode chars…

What I cannot understand is why postgres accept = these bad enconded characters into database, exports them without problema but does not = allow them when importing again.

This has been happening since postgers 7.3. = However, until 7.4.XX (y don’t remember what minor version) you could import = database without ERRORs. However, since 7.4.XX it’s impossible and = it’s imperative to clean bad characters (using iconv, for example) prior = importing tables.

I agree with this postgres policy, but what I = don’t is that you can INSERT them via application. That is, no bad characters = should be inserted into database. The check should be made for both import and insert = procedures so no bad chars would appear into database.

 

Any suggestion / appreciation about = this?

 

We are using php4/5-pgsql module from several = distros (CentOS 4/5, debian 4/5 and Ubuntu 8.04LTS) so I discard a pgsql problem and = anyway database should deal with this…

 

------=_NextPart_000_0510_01CAC9A4.DF744900-- From gabriele.bartolini@2ndQuadrant.it Mon Mar 22 21:51:14 2010 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9BE9963380D for ; Mon, 22 Mar 2010 18:51:14 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 52925-03 for ; Mon, 22 Mar 2010 21:51:03 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from delta01.pnet.xcon.it (delta01.pnet.xcon.it [62.48.53.16]) by mail.postgresql.org (Postfix) with ESMTP id D33FD63241A for ; Mon, 22 Mar 2010 18:51:03 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by delta01.pnet.xcon.it (Postfix) with ESMTP id B0F7E180A6C0; Mon, 22 Mar 2010 22:51:00 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at delta01.pnet.xcon.it Received: from delta01.pnet.xcon.it ([127.0.0.1]) by localhost (delta01.pnet.xcon.it [127.0.0.1]) (amavisd-new, port 10024) with LMTP id EJkmezkXemjN; Mon, 22 Mar 2010 22:50:58 +0100 (CET) Received: from macbook-di-gabriele-bartolini.local (host235-121-dynamic.47-79-r.retail.telecomitalia.it [79.47.121.235]) (Authenticated sender: gabriele.bartolini@devise.it) by delta01.pnet.xcon.it (Postfix) with ESMTPSA id 15B1D1808DE8; Mon, 22 Mar 2010 22:50:54 +0100 (CET) Message-ID: <4BA7E632.1080608@2ndQuadrant.it> Date: Mon, 22 Mar 2010 22:50:42 +0100 From: Gabriele Bartolini User-Agent: Thunderbird 2.0.0.24 (Macintosh/20100228) MIME-Version: 1.0 To: =?windows-1252?Q?I=F1igo_Martinez_Lasala?= CC: pgsql-admin@postgresql.org Subject: Re: Bad encoded chars in being inserted into database References: <050f01cac99c$7dafe100$790fa300$@com> In-Reply-To: <050f01cac99c$7dafe100$790fa300$@com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/155 X-Sequence-Number: 33954 Hi, > > I agree with this postgres policy, but what I don’t is that you can > INSERT them via application. That is, no bad characters should be > inserted into database. The check should be made for both import and > insert procedures so no bad chars would appear into database. > Could you please tell us which PostgreSQL version you are currently using? Also it would be useful to know: * which is your database encoding? * which is the client_encoding setting you are using? In general, what you are saying suggests me that you are using the SQL_ASCII encoding at some stage in your session (either on the server side or the client side). However, before I go on, please answer the above questions. Thanks, Gabriele -- Gabriele Bartolini - 2ndQuadrant Italia PostgreSQL Training, Services and Support gabriele.bartolini@2ndQuadrant.it | www.2ndQuadrant.it From scott.marlowe@gmail.com Mon Mar 22 22:05:56 2010 Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 9020E633B92 for ; Mon, 22 Mar 2010 19:05:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 56080-02 for ; Mon, 22 Mar 2010 22:05:45 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-gy0-f174.google.com (mail-gy0-f174.google.com [209.85.160.174]) by mail.postgresql.org (Postfix) with ESMTP id 29B4F63297D for ; Mon, 22 Mar 2010 19:05:45 -0300 (ADT) Received: by gyg8 with SMTP id 8so2880561gyg.19 for ; Mon, 22 Mar 2010 15:05:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Y6AlmrkeMiA50kO3znjXZgVjX9BW2rnxZsJ18cHAUyo=; b=VmoeEeWDPEMQf6CE4YnDJC4wDvnFWsZxkj5zUEs1XbYXt/3FEFdze7M/xD3vbJTE8f C2UavsuknavV19BXz9+g8SWTjESWcpiDWaasWceH1ILGNU2L3QlvIzXKLzjJaUZiQp4l CosoWBYYKWL6/TbMkb759Pmoc25qJqDsSBuIQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=NSF6xUAOfGN+N8pU1u0BY8S4CbAswm1Kaun9nWzLJizHRlqkS2vV+bd6JrLlfIUwWk /Ng+5LiRRXbDOXQTENVxsgV/GQuCQBunrBuOFORIYsAqChtDjnax/zUle/MPCu2nBRei Wa80H4s+pE4hNT0HJK3cuKOkFckhqdgRoxits= MIME-Version: 1.0 Received: by 10.150.1.8 with SMTP id 8mr4701078yba.298.1269295544639; Mon, 22 Mar 2010 15:05:44 -0700 (PDT) In-Reply-To: <050f01cac99c$7dafe100$790fa300$@com> References: <050f01cac99c$7dafe100$790fa300$@com> Date: Mon, 22 Mar 2010 16:05:44 -0600 Message-ID: Subject: Re: Bad encoded chars in being inserted into database From: Scott Marlowe To: =?ISO-8859-1?Q?I=F1igo_Martinez_Lasala?= Cc: pgsql-admin@postgresql.org Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201003/156 X-Sequence-Number: 33955 On Mon, Mar 22, 2010 at 2:48 AM, I=F1igo Martinez Lasala wrote: > Hi everybody. > > > > I have a doubt about how postgres deal with bad encoded characters into > database. > > We have several gforge application. They are using postgres as database. > > If we export a database and import again, we have to deal with several ba= d > encoded chars. These bad chars always come from copy & paste emails from > Lotus Notes mail client. OK, I understand the Notes client people is usin= g > is an ancient application and does not deal very well with some Unicode > chars=85 > > What I cannot understand is why postgres accept these bad enconded > characters into database, exports them without problema but does not allo= w > them when importing again. > > This has been happening since postgers 7.3. However, until 7.4.XX (y don= =92t > remember what minor version) you could import database without ERRORs. > However, since 7.4.XX it=92s impossible and it=92s imperative to clean ba= d > characters (using iconv, for example) prior importing tables. This is because postgresql's support for UTF-8 encoding (and all encoding really) has gotten tighter over time, so that the filter to catch improperly encoded UTF has gotten better with each major release. From imartinez@vectorsf.com Tue Mar 23 08:10:43 2010 Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 7FD6263374B for ; Tue, 23 Mar 2010 05:10:43 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 33145-01 for ; Tue, 23 Mar 2010 08:10:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hermes.vectorsf.com (firewall.vectorsf.com [62.82.80.62]) by mail.postgresql.org (Postfix) with ESMTP id D24886321C4 for ; Tue, 23 Mar 2010 05:10:24 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by hermes.vectorsf.com (Postfix) with ESMTP id 6E0EF11C0015; Tue, 23 Mar 2010 09:10:21 +0100 (CET) X-Virus-Scanned: amavisd-new at hermes.vectorsf.com Received: from hermes.vectorsf.com ([127.0.0.1]) by localhost (hermes.vectorsf.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id siQ1WcFf5oat; Tue, 23 Mar 2010 09:10:15 +0100 (CET) Received: from [10.70.4.200] (unknown [10.70.4.200]) (Authenticated sender: imartinez) by hermes.vectorsf.com (Postfix) with ESMTP id B08D911C003F; Tue, 23 Mar 2010 09:10:15 +0100 (CET) Subject: Re: Bad encoded chars in being inserted into database From: =?ISO-8859-1?Q?I=F1igo?= Martinez Lasala To: Gabriele Bartolini Cc: pgsql-admin@postgresql.org In-Reply-To: <4BA7E632.1080608@2ndQuadrant.it> References: <050f01cac99c$7dafe100$790fa300$@com> <4BA7E632.1080608@2ndQuadrant.it> Content-Type: multipart/alternative; boundary="=-uTaQwnr0mq6cgvQoRQnS" Date: Tue, 23 Mar 2010 09:10:16 +0100 Message-ID: <1269331816.8928.10.camel@deimos> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.08 tagged_above=-10 required=5 tests=AWL=0.518, BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201003/161 X-Sequence-Number: 33960 --=-uTaQwnr0mq6cgvQoRQnS Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Postgresql version: 8.1.13 (8.1.13-0etch1) database encoding: UTF-8. client_encoding: default, that is, it's no set at php level. However, pg_client_encoding returns "UTF8" as client encoding. Thank you, Gabriele. -----Original Message----- From: Gabriele Bartolini To: Iñigo Martinez Lasala Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] Bad encoded chars in being inserted into database Date: Mon, 22 Mar 2010 22:50:42 +0100 Hi, > > I agree with this postgres policy, but what I don’t is that you can > INSERT them via application. That is, no bad characters should be > inserted into database. The check should be made for both import and > insert procedures so no bad chars would appear into database. > Could you please tell us which PostgreSQL version you are currently using? Also it would be useful to know: * which is your database encoding? * which is the client_encoding setting you are using? In general, what you are saying suggests me that you are using the SQL_ASCII encoding at some stage in your session (either on the server side or the client side). However, before I go on, please answer the above questions. Thanks, Gabriele --=-uTaQwnr0mq6cgvQoRQnS Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit Postgresql version: 8.1.13 (8.1.13-0etch1)
database encoding: UTF-8.
client_encoding: default, that is, it's no set at php level.

However, pg_client_encoding returns "UTF8" as client encoding.

Thank you, Gabriele.

-----Original Message-----
From: Gabriele Bartolini <gabriele.bartolini@2ndQuadrant.it>
To: Iñigo Martinez Lasala <imartinez@vectorsf.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Bad encoded chars in being inserted into database
Date: Mon, 22 Mar 2010 22:50:42 +0100

Hi,
>
> I agree with this postgres policy, but what I don’t is that you can 
> INSERT them via application. That is, no bad characters should be 
> inserted into database. The check should be made for both import and 
> insert procedures so no bad chars would appear into database.
>
Could you please tell us which PostgreSQL version you are currently 
using? Also it would be useful to know:

* which is your database encoding?
* which is the client_encoding setting you are using?

In general, what you are saying suggests me that you are using the 
SQL_ASCII encoding at some stage in your session (either on the server 
side or the client side).

However, before I go on, please answer the above questions.

Thanks,
Gabriele


--=-uTaQwnr0mq6cgvQoRQnS-- From imartinez@vectorsf.com Tue Mar 23 08:12:39 2010 Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 6257363380D for ; Tue, 23 Mar 2010 05:12:39 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 33700-04 for ; Tue, 23 Mar 2010 08:12:13 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from hermes.vectorsf.com (firewall.vectorsf.com [62.82.80.62]) by mail.postgresql.org (Postfix) with ESMTP id C8AC56337DB for ; Tue, 23 Mar 2010 05:12:06 -0300 (ADT) Received: from localhost (localhost.localdomain [127.0.0.1]) by hermes.vectorsf.com (Postfix) with ESMTP id E1AF011C003C; Tue, 23 Mar 2010 09:12:03 +0100 (CET) X-Virus-Scanned: amavisd-new at hermes.vectorsf.com Received: from hermes.vectorsf.com ([127.0.0.1]) by localhost (hermes.vectorsf.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id scCOTnfCn7uJ; Tue, 23 Mar 2010 09:11:58 +0100 (CET) Received: from [10.70.4.200] (unknown [10.70.4.200]) (Authenticated sender: imartinez) by hermes.vectorsf.com (Postfix) with ESMTP id 3C42D11C0015; Tue, 23 Mar 2010 09:11:58 +0100 (CET) Subject: Re: Bad encoded chars in being inserted into database From: =?ISO-8859-1?Q?I=F1igo?= Martinez Lasala To: Scott Marlowe Cc: pgsql-admin@postgresql.org In-Reply-To: References: <050f01cac99c$7dafe100$790fa300$@com> Content-Type: multipart/alternative; boundary="=-1MNaoAgT4Wz27SRT5hZf" Date: Tue, 23 Mar 2010 09:11:58 +0100 Message-ID: <1269331918.8928.12.camel@deimos> Mime-Version: 1.0 X-Mailer: Evolution 2.28.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.117 tagged_above=-10 required=5 tests=AWL=0.481, BAYES_00=-2.599, HTML_MESSAGE=0.001 X-Spam-Level: X-Archive-Number: 201003/162 X-Sequence-Number: 33961 --=-1MNaoAgT4Wz27SRT5hZf Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit We are working with 8.1 and migrating to 8.4.... We will see if after migration this behavior has disappeared. ;-) Thank you, Scott. -----Original Message----- From: Scott Marlowe To: Iñigo Martinez Lasala Cc: pgsql-admin@postgresql.org Subject: Re: [ADMIN] Bad encoded chars in being inserted into database Date: Mon, 22 Mar 2010 16:05:44 -0600 On Mon, Mar 22, 2010 at 2:48 AM, Iñigo Martinez Lasala wrote: > Hi everybody. > > > > I have a doubt about how postgres deal with bad encoded characters into > database. > > We have several gforge application. They are using postgres as database. > > If we export a database and import again, we have to deal with several bad > encoded chars. These bad chars always come from copy & paste emails from > Lotus Notes mail client. OK, I understand the Notes client people is using > is an ancient application and does not deal very well with some Unicode > chars… > > What I cannot understand is why postgres accept these bad enconded > characters into database, exports them without problema but does not allow > them when importing again. > > This has been happening since postgers 7.3. However, until 7.4.XX (y don’t > remember what minor version) you could import database without ERRORs. > However, since 7.4.XX it’s impossible and it’s imperative to clean bad > characters (using iconv, for example) prior importing tables. This is because postgresql's support for UTF-8 encoding (and all encoding really) has gotten tighter over time, so that the filter to catch improperly encoded UTF has gotten better with each major release. --=-1MNaoAgT4Wz27SRT5hZf Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: 7bit We are working with 8.1 and migrating to 8.4....
We will see if after migration this behavior has disappeared. ;-)

Thank you, Scott.

-----Original Message-----
From: Scott Marlowe <scott.marlowe@gmail.com>
To: Iñigo Martinez Lasala <imartinez@vectorsf.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Bad encoded chars in being inserted into database
Date: Mon, 22 Mar 2010 16:05:44 -0600

On Mon, Mar 22, 2010 at 2:48 AM, Iñigo Martinez Lasala
<imartinez@vectorsf.com> wrote:
> Hi everybody.
>
>
>
> I have a doubt about how postgres deal with bad encoded characters into
> database.
>
> We have several gforge application. They are using postgres as database.
>
> If we export a database and import again, we have to deal with several bad
> encoded chars. These bad chars always come from copy & paste emails from
> Lotus Notes mail client. OK, I understand the Notes client people is using
> is an ancient application and does not deal very well with some Unicode
> chars…
>
> What I cannot understand is why postgres accept these bad enconded
> characters into database, exports them without problema but does not allow
> them when importing again.
>
> This has been happening since postgers 7.3. However, until 7.4.XX (y don’t
> remember what minor version) you could import database without ERRORs.
> However, since 7.4.XX it’s impossible and it’s imperative to clean bad
> characters (using iconv, for example) prior importing tables.

This is because postgresql's support for UTF-8 encoding (and all
encoding really) has gotten tighter over time, so that the filter to
catch improperly encoded UTF has gotten better with each major
release.

--=-1MNaoAgT4Wz27SRT5hZf--