I searched a lot, but couldn't find anything:
unsigned int unicodeChar = 0x5e9;
unsigned int utf8Char;
uni2utf8(unicodeChar, utf8Char);
assert(utf8Char == 0xd7a9);
Is there a library (preferably boost) that implements something similar to uni2utf8?
Unicode conversions are part of C++11:
Boost.Locale has also functions for encoding conversions:
You might want to give a try to UTF8-CPP library. Encoding a Unicode character with it would look like this:
std::string
is used here just as a container for UTF-8 bytes.Use sprintf. (:
cstring = sprintf("%S", unicodestring);