X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id F0DE711F6617 for ; Thu, 30 Mar 2006 17:35:18 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 24777-01 for ; Thu, 30 Mar 2006 17:35:17 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sd.tpf.co.jp (sd.tpf.co.jp [210.161.239.34]) by postgresql.org (Postfix) with SMTP id 8218911F6627 for ; Thu, 30 Mar 2006 17:35:13 -0400 (AST) Received: (qmail 28746 invoked from network); 31 Mar 2006 06:35:12 +0900 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 31 Mar 2006 06:35:12 +0900 Received: from unknown (HELO ?192.168.11.2?) (219.61.40.10) by sd.tpf.co.jp with SMTP; 31 Mar 2006 06:35:12 +0900 Message-ID: <442C4F10.3090004@tpf.co.jp> Date: Fri, 31 Mar 2006 06:35:12 +0900 From: Hiroshi Inoue User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: ja, en-us, en MIME-Version: 1.0 To: Johann Zuschlag CC: Dave Page , pgsql-odbc@postgresql.org Subject: Re: Unicode is not UTF-8. was :psqlODBC-Driver Test / text fields References: <442C3452.5020704@online.de> In-Reply-To: <442C3452.5020704@online.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.099 required=5 tests=[AWL=0.099] X-Spam-Score: 0.099 X-Spam-Level: X-Archive-Number: 200603/229 X-Sequence-Number: 7515 Johann Zuschlag wrote: > Dave Page schrieb: > >> If 'รถ' is '๖', then isn't the query above mixing single and a >> multibyte encoding? Ie. It should all be single byte - e.g. >> >> select name from kunde where name >= '๖' order by name asc; >> >> Or all multibyte (displayed byte by byte) whatever that results in: >> >> s*e*l*e*c*t* *n*a*m*e* *f*r*o*m* *k*u*n*d*e* *w*h*e*r*e* *n*a*m*e* >> *>*=* *'*รถ'*;* >> >> Of course, we all know how well I grok encoding issues :-) >> > > Hi Dave, > > I can understand you. This encoding issues drive me also crazy some > times. :-) > > The problem with UTF-8 is that all ASCII characters are represented by > one byte and all non ASCII characters, e.g. German Umlauts, are > represented by two bytes. That's why UTF-8 is called a > "variable-length multibyte encoding". In a pure Unicode world, e.g. > U+xxxx with two bytes, every character is represented by two bytes > (fixed-length multibyte encoding). So Unicode is not equal to UTF-8, > even though the PostgreSQL documentation is stating that. > > If you like, see: http://www.utf8-chartable.de/ or some explanation at > http://czyborra.com/utf/ > > Windows XP supports ANSI, UTF-8, Unicode and Unicode Big Endian. > Unfortunately (or fortunately?) Windows seems to use UTF-8 for > European languages. Hiroshi can you explain that? I guess the Japanese > edition of Windows XP is using pure 2 byte Unicode. Unicode ODBC drivers handle UCS-2 not UTF-8 even in European environemt. Unfortunately PostgreSQL doesn't handle UCS-2 directly(because it could contain NULL bytes in the string), the unicode driver sets the client_encoding to UTF-8 automatically and converts from UCS-2 data to UTF-8 data which the PostgreSQL backend can understands when sending queries. So what you can see in the backend log is UTF-8. Then the backend converts from UTF-8 data to the server encoding data. After all, the locale (especially LC_COLLATE) setting you need is the one which matches the backend encoding. > > I can't say anything about psql. But the new psqlodbc driver 7.03.26X > seems to handle that situation very well. > > So I suppose the test was valid to a certain extend, Yes thanks. I can't test the LATINxx encoding by myself. regards, Hiroshi Inoue