[unixODBC-support] what to do about unicode?

support support at forceway.com
Tue May 27 01:07:29 BST 2008


I spent a-lot of time googling and reading archives, but i'm still not
sure how to proceed. I'm writing some crossplatform odbc code. The UI is
unicode. Since it will run on Windows, it would be nice if I could just
use wchar_t and the 'wide' functions for everything. Obviously they work
on Windows, and if I could get them to work on UNIX i'd be done with no
changes to code. I'm mainly interested in targeting just MySQL right
now. It looks like I have 3 choices.

1. forget it. use ANSI functions. The UI will have to do unicode to
multibyte type conversions when making odbc calls. To REALLY get this
right i'd have to support conversions to any and all known character
sets that might be used.. because i'm coming from unicode any character
is possible.

2. perform wchar_t to UTF16 conversions when making odbc calls. On
Windows this would be sort of a noop, but on UNIX it is necessary
because wchar_t is UCS-4 and unixODBC is UTF16( or ucs-2..?). I see no
standard functions for this conversion on UNIX. Guess I would need to
use a library like iconv or ICU.

3. I can make unixODBC take wchar_t/ucs-4 by using defining
SQL_WCHART_CONVERT. This would be great! ...but it will only work if my
drivers support it and if unixODBC has been built for it. How do I know?
>From what i've read it doesn't work or hasn't been tested.

thanks



More information about the unixODBC-support mailing list