I'm using ICU (because I needed for boost regex to work with unicode):
UConverter *pConverterUTF8;
UErrorCode nUError;
// open converter
nUError = U_ZERO_ERROR;
pConverterUTF8=ucnv_open("utf-8",&nUError);
// do conversions
mystring = UnicodeString(utf8,strlen(utf8),pConverterUTF8,&nUError);
// close converter
ucnv_close(pConverterUTF8);
Handling Unicode has more to do than just conversion :(, but ICU offers many
functions.
Andrea
-----Messaggio originale-----
Da: boost-users-bounces@lists.boost.org
[mailto:boost-users-bounces@lists.boost.org] Per conto di Cory Nelson
Inviato: giovedì 7 agosto 2008 15.27
A: boost-users@lists.boost.org
Oggetto: Re: [Boost-users] about UTF8 to UNICODE
On Thu, Aug 7, 2008 at 2:21 AM, Ken zhang
Hello
I hava a UTF8 string reading from TinyXML, I want convert to a Unicode string (wchar_t) for some reasons, How can convert it by boost?
Boost doesn't have anything to do this. I've got some code here you can
use:
http://svn.int64.org/svnroot/int64/snips/unicode.hpp
std::string u8;
std::wstring wc;
unicode::transcode