views:

60

answers:

2

I have a string like this: "These are Pi (\u03a0) and Sigma (\u03a3).". How can i convert this to contain and print effective characters, using C++ standard libraries?

This solution http://msdn.microsoft.com/en-us/library/system.text.encoding.utf8(VS.80).aspx, use .NET framework (/clr compiling), that i want to avoid preferring C++ standard libraries.

Thank you in advance.

A: 

I don't know if there's a way to do this using the standard library, altough my guess would be that there isn't. You could however use iconv. It's part of gnus standard C library, but there's a windows dll available.

Emil H
+1  A: 

I am not quite sure what you mean by "standard", but I guess you meant "unmanaged". If that's what you want, please try ICU. It is not very easy to master, but it is definitely capable of such conversions.

BTW. If you simply want to convert UTF-16 encoded wstring to UTF-8 encoded string, you can do it with WideCharToMultiByte() API call (assuming Windows).

Paweł Dyda