Re: Postgres (EUC - JP encoded ) with Unicode MFC Application

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: krishnan swaminathan <krishnan1469(at)gmail(dot)com>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: Postgres (EUC - JP encoded ) with Unicode MFC Application
Date: 2010-01-04 09:33:41
Message-ID: db471ace1001040133l622c9861k2472e166e068cfd2@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

Hi Krish,

> I have an MFC application built with unicode characterset enabled (so
> CString and the MFC API's expects wide characters) and the postgres db as
> backend which is EUC - JP encoded.
> Iam accessing my DB using CRecordset for reading the tables and direct query
> execution using ExecuteSQL for updation., Both these MFC functions expects
> wide strings of 2 bytes but my DB is multibyte encoded of 1 byte. Can anyone
> please let me know how to handle this scenario of Unicode application with
> multibyte encoded DB.

I'm not sure of the exact details of MFC's wide characters, but I do
know that if you were in a western European locale and weren't using
MFC unicode, you could set client encoding to win1251 or somesuch and
it would work.

Find out what encoding MFC wants for wide character strings, and see
if it's available as a client encoding:

http://www.postgresql.org/docs/8.4/static/multibyte.html

Incidentally, it might be worth considering ditching ODBC and using libpqxx.

Regards,
Peter Geoghegan

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message noreply 2010-01-05 07:09:37 [ psqlodbc-Bugs-1010739 ] Crash in psqlodbc35w.dll v8.4.1 when getting data of type &amp; amp; quot; TEXT&amp; amp; quot; from PSQL Server v8.3.6
Previous Message krishnan swaminathan 2010-01-04 07:59:11 Postgres (EUC - JP encoded ) with Unicode MFC Application