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 A426311F660F for ; Thu, 30 Mar 2006 15:40:21 -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 73560-06 for ; Thu, 30 Mar 2006 15:40:20 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.126.177]) by postgresql.org (Postfix) with ESMTP id B2D0A11F660A for ; Thu, 30 Mar 2006 15:40:18 -0400 (AST) Received: from [84.143.24.54] (helo=[84.143.24.54]) by mrelayeu.kundenserver.de (node=mrelayeu2) with ESMTP (Nemesis), id 0MKwtQ-1FP3071SvQ-0001nV; Thu, 30 Mar 2006 21:40:14 +0200 Message-ID: <442C3452.5020704@online.de> Date: Thu, 30 Mar 2006 21:41:06 +0200 From: Johann Zuschlag User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Dave Page CC: Hiroshi Inoue , pgsql-odbc@postgresql.org Subject: Unicode is not UTF-8. was :psqlODBC-Driver Test / text fields References: In-Reply-To: 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/227 X-Sequence-Number: 7513 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. 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, since the characters are handled in this mixed way in Win XP. I still have some funny behaviour with Unicode in psql (even after setting LC_COLLATE correctly :-) ). For my production machines I will anyway use ISO-8859-1 (or ISO-8859-15). Then the driver will convert all characters to single byte avoiding all kind of problems. But feel free to ask me for tests... ;-) Regards, Johann