Q:

Convert ICU UnicodeString to platform dependent char * (or std::string)

In my application I use ICU UnicodeString to store my strings. Since I use some libraries incompatible with ICU, I need to convert UnicodeString to its platform dependent representation.
Basicly what I need to do is reverse process form creating new UnicodeString object - new UnicodeString("string encoded in system locale").
I found out this topic - so I know it can be done with use of stringstream.
So my answer is, can it be done in some other simpler way, without using stringstream to convert?

A:

i use
std::string converted;
us.toUTF8String(converted);

us is (ICU) UnicodeString

A:

You could use UnicodeString::extract() with a codepage (or a converter).  Actually passing NULL for the codepage will use what ICU detected as the default codepage.

