From andrew.biagioni@e-greek.net Sat Dec 13 15:19:04 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 8D44CD1D10B for ; Sat, 13 Dec 2003 15:19:04 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 07721-04 for ; Sat, 13 Dec 2003 11:18:36 -0400 (AST) Received: from sycorax.affordablehost.com (sycorax.affordablehost.com [216.46.192.84]) by svr1.postgresql.org (Postfix) with ESMTP id 58E20D1CCAB for ; Sat, 13 Dec 2003 11:18:27 -0400 (AST) Received: from h0040054d8ee4.ne.client2.attbi.com ([66.31.57.228] helo=e-greek.net) by sycorax.affordablehost.com with asmtp (TLSv1:RC4-MD5:128) (Exim 4.24) id 1AVBX6-0007WS-H1; Sat, 13 Dec 2003 10:18:16 -0500 Message-ID: <3FDB2DBA.8000505@e-greek.net> Date: Sat, 13 Dec 2003 10:18:18 -0500 From: Andrew Biagioni User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030718 X-Accept-Language: en-us, en, it, it-ch, fr-fr, fr-ch, de-de, de-ch MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Mis-interpreted extended character Content-Type: multipart/alternative; boundary="------------010107060801040805090402" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sycorax.affordablehost.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - e-greek.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/180 X-Sequence-Number: 11687 This is a multi-part message in MIME format. --------------010107060801040805090402 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Our database ( (PostgreSQL) 7.3.5 ) uses Unicode encoding: egreek=# \l List of databases Name | Owner | Encoding -------------+----------+---------- egreek | andrew | UNICODE For some reason, If I try to use an extended character (ASCII code > 127) in a string, I get this peculiar result: egreek=# SELECT LOWER ( 'Niņo' ); egreek'# (note: it fails to see the closing single-quote character; I hit CTRL-C to quit the operation) and: egreek=# SELECT LOWER ( 'Niņo ' ); ERROR: Unicode >= 0x10000 is not supported (note: I added a space before the closing quote). It looks to me like the 'ņ' character (spanish n with tilde - ASCII 164, as far as I can tell) is messing with the parser somehow. Furthermore -- this is data coming from a form in a web site used globally, so I have little control over what is passed to me (me = PostgreSQL DB). I can't (without lotsa hassles) "demand" that higher-ASCII characters be encoded on the way in, and decoded on the way out. Any suggestions/info/hints? Thanks, Andrew --------------010107060801040805090402 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Our database ( (PostgreSQL) 7.3.5 ) uses Unicode encoding:

    egreek=# \l
             List of databases
        Name     |  Owner   | Encoding
    -------------+----------+----------
     egreek      | andrew   | UNICODE

For some reason, If I try to use an extended character (ASCII code > 127) in a string, I get this peculiar result:

    egreek=# SELECT  LOWER ( 'Niño' );
    egreek'#

(note:  it fails to see the closing single-quote character;  I hit CTRL-C to quit the operation)

and:

    egreek=# SELECT  LOWER ( 'Niño ' );
    ERROR:  Unicode >= 0x10000 is not supported

(note:  I added a space before the closing quote).

It looks to me like the '
ñ' character (spanish n with tilde - ASCII 164, as far as I can tell) is messing with the parser somehow.

Furthermore -- this is data coming from a form in a web site used globally, so I have little control over what is passed to me (me = PostgreSQL DB).  I can't (without lotsa hassles) "demand" that higher-ASCII characters be encoded on the way in, and decoded on the way out.

Any suggestions/info/hints?

Thanks,

                 Andrew

--------------010107060801040805090402-- From list@1006.org Sat Dec 13 15:39:35 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 34993D1D17D for ; Sat, 13 Dec 2003 15:39:35 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 09019-06 for ; Sat, 13 Dec 2003 11:39:08 -0400 (AST) Received: from my.endian.it (unknown [62.146.87.34]) by svr1.postgresql.org (Postfix) with ESMTP id 60D18D1D0AE for ; Sat, 13 Dec 2003 11:38:48 -0400 (AST) Received: from [192.168.1.2] (host36-118.pool80180.interbusiness.it [80.180.118.36]) (authenticated) by my.endian.it (8.11.6/8.11.6) with ESMTP id hBDG51b16739 for ; Sat, 13 Dec 2003 17:05:01 +0100 Subject: Re: Mis-interpreted extended character From: Chris To: pgsql-admin@postgresql.org In-Reply-To: <3FDB2DBA.8000505@e-greek.net> References: <3FDB2DBA.8000505@e-greek.net> Content-Type: text/plain Message-Id: <1071329925.2161.22.camel@linuxbox> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 (1.4.5-7) Date: Sat, 13 Dec 2003 16:38:46 +0100 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/181 X-Sequence-Number: 11688 > Our database ( (PostgreSQL) 7.3.5 ) uses Unicode encoding: > [...] > For some reason, If I try to use an extended character (ASCII code > > 127) in a string, I get this peculiar result: > [...] Probably your terminal is set to ISO-8859-1 ("latin 1") or something like that, while your database is set to unicode as you showed. Hence the mismatch. In unicode (for example UTF-8) non-US-ASCII characters are encoded with two bytes (as opposed to one byte > 127 as happens with ISO-8859-1). Solution is to have everything agree on the encoding. Terminal + DB or Web Browser + DB. Btw. you _do_ actually have an influence on what encoding a web browser uses by setting the "encoding" HTTP header. According to my experience, if you have to deal with only western european encodings, you're better off (still) with ISO-8859-1 (or ISO-8859-15 to have the EUR symbol too). Short answer: not PostgreSQL's fault. Bye, Chris. From andrew.biagioni@e-greek.net Tue Dec 16 01:26:14 2003 X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 11B42D1D614 for ; Tue, 16 Dec 2003 01:26:14 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 48651-10 for ; Mon, 15 Dec 2003 21:25:54 -0400 (AST) Received: from sycorax.affordablehost.com (sycorax.affordablehost.com [216.46.192.84]) by svr1.postgresql.org (Postfix) with ESMTP id 5B234D1D361 for ; Mon, 15 Dec 2003 21:25:40 -0400 (AST) Received: from h0040054d8ee4.ne.client2.attbi.com ([66.31.57.228] helo=e-greek.net) by sycorax.affordablehost.com with asmtp (TLSv1:RC4-MD5:128) (Exim 4.24) id 1AW3y1-0006uH-Vs; Mon, 15 Dec 2003 20:25:42 -0500 Message-ID: <3FDE5F11.6010101@e-greek.net> Date: Mon, 15 Dec 2003 20:25:37 -0500 From: Andrew Biagioni User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5a) Gecko/20030718 X-Accept-Language: en-us, en, it, it-ch, fr-fr, fr-ch, de-de, de-ch MIME-Version: 1.0 To: pgsql-admin@postgresql.org Subject: Re: Mis-interpreted extended character References: <3FDB2DBA.8000505@e-greek.net> <1071329925.2161.22.camel@linuxbox> In-Reply-To: <1071329925.2161.22.camel@linuxbox> Content-Type: multipart/alternative; boundary="------------000603020108060609030707" X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sycorax.affordablehost.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - e-greek.net X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/213 X-Sequence-Number: 11719 This is a multi-part message in MIME format. --------------000603020108060609030707 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Chris, Thanks -- your answer is 90% of what I need! As for the other 10%: Chris wrote: >>Our database ( (PostgreSQL) 7.3.5 ) uses Unicode encoding: >>[...] >> >> > > > >>For some reason, If I try to use an extended character (ASCII code > >>127) in a string, I get this peculiar result: >> >> > > > >>[...] >> >> > >Probably your terminal is set to ISO-8859-1 ("latin 1") or something >like that, while your database is set to unicode as you showed. > >Hence the mismatch. In unicode (for example UTF-8) non-US-ASCII >characters are encoded with two bytes (as opposed to one byte > 127 >as happens with ISO-8859-1). Solution is to have everything agree on the >encoding. Terminal + DB or Web Browser + DB. > >Btw. you _do_ actually have an influence on what encoding a web browser >uses by setting the "encoding" HTTP header. > >According to my experience, if you have to deal with only western >european encodings, you're better off (still) with ISO-8859-1 (or >ISO-8859-15 to have the EUR symbol too). > > >Short answer: not PostgreSQL's fault. > Agreed -- and thanks for the above info. It ALSO turns out that Java has its own issues with >127 characters, which I'm going to look into -- but it was nice to prove you right (and solve half my problem!) by setting the web page encoding... >Bye, Chris. > > > >---------------------------(end of broadcast)--------------------------- >TIP 9: the planner will ignore your desire to choose an index scan if your > joining column's datatypes do not match > Thanks again, Andrew --------------000603020108060609030707 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit Chris,

Thanks -- your answer is 90% of what I need!  As for the other 10%:

Chris wrote:
Our database ( (PostgreSQL) 7.3.5 ) uses Unicode encoding: 
[...]
    

  
For some reason, If I try to use an extended character (ASCII code >
127) in a string, I get this peculiar result:
    

  
[...]
    

Probably your terminal is set to ISO-8859-1 ("latin 1") or something
like that, while your database is set to unicode as you showed.
Hence the mismatch. In unicode (for example UTF-8) non-US-ASCII
characters are encoded with two bytes (as opposed to one byte > 127 
as happens with ISO-8859-1). Solution is to have everything agree on the
encoding. Terminal + DB or Web Browser + DB.

Btw. you _do_ actually have an influence on what encoding a web browser
uses by setting the "encoding" HTTP header.

According to my experience, if you have to deal with only western
european encodings, you're better off (still) with ISO-8859-1 (or
ISO-8859-15 to have the EUR symbol too).


Short answer: not PostgreSQL's fault.
Agreed -- and thanks for the above info.

It ALSO turns out that Java has its own issues with >127 characters, which I'm going to look into -- but it was nice to prove you right (and solve half my problem!) by setting the web page encoding...
Bye, Chris.



---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
      joining column's datatypes do not match

Thanks again,

        Andrew

--------------000603020108060609030707--