Re: UNICODE - Mailing list pgsql-odbc

From Hiroshi Inoue
Subject Re: UNICODE
Date
Msg-id 51DD87FD.1010600@tpf.co.jp
Whole thread Raw
In response to Re: UNICODE  (FAU <fau@email.com>)
List pgsql-odbc
(2013/07/10 13:17), FAU wrote:
> On Wed, 2013-07-10 at 12:27 +0900, Inoue, Hiroshi wrote:
>> Hi,
>>
>> (2013/07/10 1:29), FAU wrote:
>>> Hello,
>>>
>>> I'm trying to understand how (unix)ODBC and psqlodbc work together
>>> regarding UNICODE.
>>>
>>> So from what I understand is that ODBC UNICODE is/was inherently
>>> UCS-2LE.
>>
>> Currently UTF-16LE or UTF-16BE according to the endianness of the
>> machine.
>>
>>> Does the UNICODE driver version (which is psqlodbcw.so I
>>> assume) expect/send UCS-2LE or (as I read somewhere) UTF-8, or does it
>>> expect/send whatever the back-end database is setup to?
>>
>> The unicode driver expects UTF-16 not UTF-8.
>> If you are to pass/accept UTF-8 string parameters, use the ANSI
>> version of the driver and set client_encoding to 'UTF-8'.
>
> What if the back end database is not setup to unicode (e.g. 8859-1 or
> whatever) and the odbc client decides to use the wide/utf-16 API
> does this work out for the client?

Yes as long as the client passes valid strings for the database.

 > If it does then this would mean that
> there would be some conversion along the path (either done by the driver
> manager, the driver or the database).

Yes the driver does the conversion between UTF-16 and UTF-8 and
the PG database does the conversion between UTF-8 and the database
encoding. Though the PG database provides the conversion functionality
between the client encoding and the server encoding, it doesn't
support UTF-16 unfortunately.

regards,
Hiroshi INoue



pgsql-odbc by date:

Previous
From: HAAS Benjamin
Date:
Subject: Remote connection through ODBC
Next
From: Michael Paquier
Date:
Subject: Re: Ignore automatically-generated files in source code with .gitignore