pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Craig Ringer <craig@postnewspapers.com.au>
To: yufeng230@sina.com
Cc: pgsql-odbc <pgsql-odbc@postgresql.org>
Subject: Re: pgsqlodbc utf8 windows?
Date: Tue, 24 Aug 2010 10:09:09 +0800
Message-ID: <4C7329C5.4060503@postnewspapers.com.au> (raw)
In-Reply-To: <20100821030910.CF5EC16A403@mail3-245.sinamail.sina.com.cn>
References: <20100821030910.CF5EC16A403@mail3-245.sinamail.sina.com.cn>

On 08/21/2010 11:09 AM, yufeng230@sina.com wrote:
> hi:
>
> In windows,I set postgresql _encoding utf8_ with chinese text inside.
> _, when I use psqlodbc-08.04.0200 psqlodbc35w.dll to _connect postgresql
> ,but no OK ,read text encoding with UCS2,how to solve it ?

UCS2 and utf8 are both unicode encodings. The text should be the same, 
just encoded differently. The ODBC driver is converting the UTF-8 it 
gets from PostgreSQL into UCS-2, because that's the standard encoding 
used by Windows and by the Windows Unicode ODBC driver.

If for some reason you really need UTF-8, you should use the standard 
Windows encoding conversion functions, or use libiconv, to convert from 
the UCS-2 data you get from the ODBC driver back to UTF-8.

Another option is to install the non-unicode ODBC driver for PostgreSQL, 
which will pass whatever the database sends through to do you directly. 
That way you should get UTF-8.

--
Craig Ringer



view thread (2+ messages)

Message-ID: <4C7329C5.4060503@postnewspapers.com.au>
Permalink:  ../4C7329C5.4060503@postnewspapers.com.au/
Also on:    postgresql.org/message-id/4C7329C5.4060503@postnewspapers.com.au

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: craig@postnewspapers.com.au, yufeng230@sina.com
  Subject: Re: pgsqlodbc utf8 windows?
  In-Reply-To: <4C7329C5.4060503@postnewspapers.com.au>
  References: <20100821030910.CF5EC16A403@mail3-245.sinamail.sina.com.cn> <4C7329C5.4060503@postnewspapers.com.au>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox