Impz0r wrote:To get a CEGUI::String content into a std::string i do something like:
Code: Select all
std::string blah = control->getText().c_str();
This works most of the time, but not with these "äöü". Internally the string is converted to utf8 and thereby the "äüö" get fecked up somehow.
Can you clarify this bit:
Internally the string is converted to utf8 - do you mean by std::string, or the fact that CEGUI::String does this? I'm not aware of std::string having such a function, and the reason CEGUI does it is because it's impossible to represent the entire set of Unicode code points in 8 bit chars (so we use utf8 in that case).
Impz0r wrote:PS: And besides, why is CEGUI not using the std::string class it does also support unicode?
I don't believe std::string does support unicode, even the wide character type that's in the standard is not too helpful for us because the actual representation is not specified and so varies by implementation - it's for this reason we wrote a string class that we can rely on to do what we expect in all cases
![Wink ;)](./images/smilies/icon_wink.gif)
So, to clear up a couple of points. What representation are you yourself using for characters? Some form of actual unicode or ISO/IEC 8859-1 or something else?
![Smile :)](./images/smilies/icon_smile.gif)
Knowing this will aid in coming up with a suitable conversion, though largely it will involve accessing the UTF32 codes in the CEGUI::String and stuffing them into your std:: string (after applying any required conversion).
CE.