odbc part deleted
Milan Babuskov
milanb at panonnet.net
Wed Nov 7 04:09:07 PST 2007
Ayen Yang wrote:
> Since the ODBC class will be discontinued, I tried to use the native
> library of PostgreSQL to access the database.
>
> I tried to get some data from a table and put them in a ListCtrl. I
> found a problem that the character displayed in the ListCtrl somehow
> 'scrambled' and cannot be read (some of the characters look like
> Chinese and Korean).
> I think the problem is in the conversion from the PQgetvalue() to
> wxString, but I don't know for sure.
> I've tried many of wxString conversion functions, but the result is
> still the same.
>
> Does anyone ever experience the same problem? Please help me.
You should convert the characters from your connection charset to native
charset of wx application/windowing environment. We do it like that in
FlameRobin (admin tool for Firebird database). I don't know how PG
works, but it should be similar. Example:
- database table/column is UTF8
- your connection character set is WIN1252
- you are using some Linux with UTF8 charset environment
The DBMS engine should convert UTF8 -> WIN1252 and you would get data in
such form. Then you need to convert it from WIN1252 to UTF8 for display
on screen.
Take a look at our conversion routines here:
http://flamerobin.svn.sourceforge.net/viewvc/flamerobin/trunk/flamerobin/src/core/StringUtils.cpp?revision=1351&view=markup
It is made to work on Windows, Linux, MacOSX, etc. in both Unicode and
Ansi mode.
--
Milan Babuskov
http://www.flamerobin.org
More information about the wx-users
mailing list