Boost logo

Boost Users :

Subject: Re: [Boost-users] UTF-16
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2009-06-15 11:45:44


On Mon, Jun 15, 2009 at 3:55 AM, Boris Schaeling <boris_at_[hidden]> wrote:

> 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,

This is a good idea. I had thought about this, but I was hoping there was a
more portable solution already out there. If not, then I could just create a
simple abstraction for the platform specific routines.

Thanks for your help (And to everyone else as well)!



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