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 F19BE11F6C21 for ; Fri, 31 Mar 2006 21:27:54 -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 72402-04 for ; Fri, 31 Mar 2006 21:27:54 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from samwel.tk (bsamwel.xs4all.nl [82.92.179.183]) by postgresql.org (Postfix) with ESMTP id BB97C11F681A for ; Fri, 31 Mar 2006 21:27:50 -0400 (AST) Received: from localhost ([127.0.0.1]) by samwel.tk with esmtp (Exim 4.60) (envelope-from ) id 1FPUu1-0006QU-FB; Sat, 01 Apr 2006 03:27:45 +0200 Message-ID: <442DD6E2.5070500@samwel.tk> Date: Sat, 01 Apr 2006 03:26:58 +0200 From: Bart Samwel User-Agent: Thunderbird 1.5 (Windows/20051201) MIME-Version: 1.0 To: Marc Herbert CC: 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> <442D5DFB.4080501@online.de> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: bart@samwel.tk X-SA-Exim-Scanned: No (on samwel.tk); SAEximRunCond expanded to false X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.068 required=5 tests=[AWL=0.068] X-Spam-Score: 0.068 X-Spam-Level: X-Archive-Number: 200603/240 X-Sequence-Number: 7526 Marc Herbert wrote: > Johann Zuschlag writes: > >> I've read about the problems with the NULL bytes on Unix machines. > > This problem is not related to Unix at all but to the programming > language used. Most standard C functions use the zero byte convention > as a string terminator, so it becomes a forbidden character in C. > > On the other hand String objects in C++ and Java use a separate length > field, and having NULLs inside a string is a no brainer there. > > The ODBC API has been designed for C and Cobol. Cobol does not forbid > zero as a character either. When browsing the ODBC spec you'll notice > it carefully caters for the two ways. > > > Guess which programming language is used PostgreSQL. C++ even introduced a special alternative character type "wchar_t" for this, just so that people could handle both 8-bit char* and 16-bit wchar_t* strings. In wchar_t* strings, 8-bit NULs are not a problem because only 16-bit NULs count (and AFAIK the Unicode standard does allows this to be interpreted as a NUL aka end-of-string). The downside of this solution is that no application actually uses it, and everybody is stuck with 8-bit ASCII plus a random local codepage unless special support is added. Why didn't they just upgrade chars to 32 bits and be done with it... :-/ Cheers, Bart