Search code examples
c++linuxutfwchar-t

How to convert (not necessarily programmatically) between Windows' wchar_t and GCC/Linux one?


Suppose I have this Windows wchar_t string:

L"\x4f60\x597d"

and

L"\x00e4\x00a0\x597d"

and would like to convert it (not necessarily programmatically; it will be a one-time thing) to GCC/Linux wchar_t format, which is UTF-32 AFAIK. How do I do it? (a general explanation would be nice, but example based on this concrete case would be helpful as well)

Please don't direct me to character conversion sites. I would like to convert from L"\x(something)" form and not "end character" form.


Solution

  • One of the most used libraries to do character conversion is the ICU library http://icu-project.org/ It is e.g. used by some boost http://www.boost.org/ libraries.