Обсуждение: Problem reading utf8 on windows XP
Excuse me, if I haven't fully understood the subject here...
I have a postgres db 8.1.11 on Linux. The data is utf8-encoded in the db.
I have no problems reading or writing utf8 on Linux.
Now, when I try to read data on a machine running windows xp, with odbc version 8.02.04.00.
I cannot manage to read utf8. How do I do that?
I am a bit lost concerning how to configure odbc.
Which driver am I supposed to use to just get the "plain" utf8 right out of the database _without any conversions_?
Now it seems like I am getting some kind of mbcs or ISO-8859-1 encoded data or something like that.
I tried to use the Unicode driver. Is that the right one?
I am using visual studio 2005. There I have an option to set character encoding. Now, if I choose to set it to UNICODE
I will get a compilation error, since then SQLConnect will be defiend as SQLConnectW, which in turn expects that I use WCHAR instead of CHAR and similar errors. I think I would like to just get utf8 data back in CHARs, not WCHARs.
Below is an excerpt of how I try to read data back. This seems to work on Linux where
everything seemingly work out as I expect.
rc = SQLGetData(_statementHandle, column, SQL_C_CHAR, valueBuf.get(), bufSize, &length);
Moreover, I have not foun any documentation that brings clarity to the subject, so if you have any
hints to where I could find documentation with examples I would be glad.
Best regards,
Paul.
Gör personlighetstestet på MSN Dejting, se vem du passar ihop med! MSN Dejting
I have a postgres db 8.1.11 on Linux. The data is utf8-encoded in the db.
I have no problems reading or writing utf8 on Linux.
Now, when I try to read data on a machine running windows xp, with odbc version 8.02.04.00.
I cannot manage to read utf8. How do I do that?
I am a bit lost concerning how to configure odbc.
Which driver am I supposed to use to just get the "plain" utf8 right out of the database _without any conversions_?
Now it seems like I am getting some kind of mbcs or ISO-8859-1 encoded data or something like that.
I tried to use the Unicode driver. Is that the right one?
I am using visual studio 2005. There I have an option to set character encoding. Now, if I choose to set it to UNICODE
I will get a compilation error, since then SQLConnect will be defiend as SQLConnectW, which in turn expects that I use WCHAR instead of CHAR and similar errors. I think I would like to just get utf8 data back in CHARs, not WCHARs.
Below is an excerpt of how I try to read data back. This seems to work on Linux where
everything seemingly work out as I expect.
rc = SQLGetData(_statementHandle, column, SQL_C_CHAR, valueBuf.get(), bufSize, &length);
Moreover, I have not foun any documentation that brings clarity to the subject, so if you have any
hints to where I could find documentation with examples I would be glad.
Best regards,
Paul.
Gör personlighetstestet på MSN Dejting, se vem du passar ihop med! MSN Dejting