[unixODBC-support] what to do about unicode?

support support at forceway.com
Thu May 29 07:14:34 BST 2008

Nick Gorham wrote:
> support wrote:
>>> Ok. I was planning a thin wrapper around the odbc calls anyway. I can
>>> put the wchar_t <--> utf16 conversion in there. I don't even know that
>>> unicode in the database is really necessary, but the UI will be unicode
>>> so I might as well be doing odbc unicode to UI unicode conversions
>>> instead of odbc ascii to UI unicode.
>>> -john
>>> _______________________________________________
> If you get the chance to make a list of the functions you use, it may
> be worth us thinking about creating a helper library of such functions.
I just made a light c++ class to encapsulate SQLWCHAR strings.
It can be constructed from a std::wstring (and therefore a wchar_t string).
It has a static member function that can take a SQLWCHAR string and
return std::wstring.
It has a SQLWCHAR * operator overload so it can be passed directly to
ODBC calls.

On Linux iconv() is used for WCHAR_T <-> UTF16 conversions.
On windows it just internally stores a std::wstring reference, no
conversion is done.

I think that will cover my needs. At least so far. If interested I can
make the code available.


More information about the unixODBC-support mailing list