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 3E40711F663E for ; Fri, 31 Mar 2006 12:51:28 -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 59282-07 for ; Fri, 31 Mar 2006 12:51:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.186]) by postgresql.org (Postfix) with ESMTP id 2909611F665F for ; Fri, 31 Mar 2006 12:51:25 -0400 (AST) Received: from [84.143.39.111] (helo=[84.143.39.111]) by mrelayeu.kundenserver.de (node=mrelayeu1) with ESMTP (Nemesis), id 0MKwpI-1FPMpy2A6R-0002Ur; Fri, 31 Mar 2006 18:51:17 +0200 Message-ID: <442D5DFB.4080501@online.de> Date: Fri, 31 Mar 2006 18:51:07 +0200 From: Johann Zuschlag User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Hiroshi Inoue , Dave Page , pgsql-odbc@postgresql.org Subject: Re: Unicode is not UTF-8. was :psqlODBC-Driver Test / text References: <442C3452.5020704@online.de> <442C4F10.3090004@tpf.co.jp> In-Reply-To: <442C4F10.3090004@tpf.co.jp> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: kundenserver.de abuse@kundenserver.de login:412dbd38c76468b7d75e624f8951f259 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.12 required=5 tests=[AWL=0.120] X-Spam-Score: 0.12 X-Spam-Level: X-Archive-Number: 200603/235 X-Sequence-Number: 7521 Hiroshi Inoue schrieb: > > 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. > Hmm..., so Windows XP uses UCS-2 or do be more correct (like Bart mentioned) UTF-16 (which is nearly the same, except for the surrogates). That is converted to UTF-8, sent to the backend and then converted to the proper locale and stored. I've read about the problems with the NULL bytes on Unix machines. Let's have two examples: 1. backend-1 = ISO8859-1 backend-2 = UTF-8 'A' = U+0041 (does windows use big-endian?) Win UCS-2: U+0041 ODBC UTF-8: U+41 backend-1 stores = 0x41 backend-2 stores = U+41 2. 'Ä' = U+00C4 (german A-Umlaut) Win UCS-2: U+00C4 ODBC UTF-8: U+C384 backend-1 stores = 0xC4 backend-2 stores = U+C384 Did I get that right? So I have to be really careful when testing. Regards, Johann