Re: Unicode is not UTF-8. was :psqlODBC-Driver Test / text - Mailing list pgsql-odbc

From Bart Samwel
Subject Re: Unicode is not UTF-8. was :psqlODBC-Driver Test / text
Date
Msg-id 4430E4EC.2010208@samwel.tk
Whole thread Raw
In response to Re: Unicode is not UTF-8. was :psqlODBC-Driver Test / text  (Marc Herbert <Marc.Herbert@continuent.com>)
List pgsql-odbc
Marc Herbert wrote:
> Bart Samwel <bart@samwel.tk> writes:
> wchar_t is not defined as 16-bits, but as "wide enough to hold any
> character of the platform". For instance if the platform uses UCS-4,
> then wchar_t is 32 bits wide.
>
> (UTF-16 wchar_t violates this)

Ahhh, this explains a lot. The same assumption used to be true for char
until they came up with UTF-8 char. And they couldn't just upgrade char
because too much code assumed that char was one byte. Then platforms
started to use UCS-2 wchar_t, then upgraded those to UTF-16 because they
couldn't just upgrade wchar_t because too much code assumed that wchar_t
was two bytes. Same pattern. Time to introduce wwchar_t_t. :-)

> I don't clearly see how you want to use a 8-bit NULL to terminate a
> (wider) wchar_t array... ?

This was a backreference to a situation mentioned earlier in the
discussion, where wchar_t buffers couldn't be "tunneled through" a layer
that used char*, as the wider wchar_t characters may contain NUL bytes.

Cheers,
Bart

pgsql-odbc by date:

Previous
From: Marc Herbert
Date:
Subject: Re: Unicode is not UTF-8. was :psqlODBC-Driver Test / text
Next
From: Johann Zuschlag
Date:
Subject: Re: Unicode is not UTF-8. was :psqlODBC-Driver Test / text