[unixODBC-support] unixODBC and Unicode

Fredrik Ålund fredrik.alund at mimer.se
Wed Jan 31 08:42:49 GMT 2007


Nick,

Why does unixODBC use 2 byte SQLWCHAR on Linux? Since wchar_t is 4 byte
and all standard string (the unicode version like wscmp) used wchar_t I
can not use any of them with SQLWCHAR. How am I supposed to work with
SQLWCHAR? For portability between Linux and Windows, would it not be
better to use wchar_t as SQLWCHAR? Even though wchar_t is 2 byte on
Windows, how many applications really care about that? Most (all)
applications I have seen simply uses wchar_t and that would be portable
to unixODBC if SQLWCHAR was typedefed as wchar_t. As it is now SQLWCHAR
(and therefore all W-functions) are very cumbersome to use. Now I use
the ANSI versions of the ODBC functions and UTF-8, but when I write a
new Unicode application it would be much easier to be able to use
wchar_t and all standard C functions together with SQLWCHAR and the -W
versions of the ODBC functions.

I know I can recompile unixODBC to use 4 byte SQLWCHAR, but then I
cannot rely on other users unixODBC installation to work with my
application. Furthermore, I might break other applications when I build
unixODBC with 4 byte SQLWCHAR.


Regards,
Fredrik



More information about the unixODBC-support mailing list