|
Boost Users : |
Subject: Re: [Boost-users] UTF-16
From: Boris Schaeling (boris_at_[hidden])
Date: 2009-06-15 04:55:18
On Sun, 14 Jun 2009 21:41:16 +0200, Robert Dailey <rcdailey_at_[hidden]>
wrote:
> [...]Great advice Zach. I'll definitely do this. However, it would be
> nice to
> have an already-made conversion routine for UTF8 to UTF16. I'm hoping
The conversion routines you are looking for are std::mbsrtowcs() and
std::wcsrtombs() in <cwchar>. You must set the global locale first before
you use them so they know which multi-byte encoding they should use (try
for example "en_US.UTF-8"). If you want your application to work on
Windows, too, you can't use those functions unfortunately but must use
MultiByteToWideChar() and WideCharToMultiByte() instead (as there is no
UTF-8 locale on Windows).
The Unicode FAQ for Unix and Linux might also help:
http://www.cl.cam.ac.uk/~mgk25/unicode.html
Boris
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net