Sven Bauhan wrote:
Your class uses XMLString::transcode(), which transcodes to the local code
page.  This will result in data loss in cases where content contains
Unicode characters that are not representable in the local code page.  A
better choice would be to transcode to UTF-8, which is compatible with
char* APIs, and has the advantage that it can represent any Unicode
character.

I also found this not quite good, but I could not find out how to convert to UTF-8. Perhaps you could provide an example?

Anyhow std::string is not capable handling UTF-8 - so the data has to be transcoded using the local code page when using std::string.
This is not true. std::string and UTF-8 are fully compatible, as long as you make no assumptions about chopping things up at arbitrary indices, or the relationship of Unicode code points and UTF-8 code units. At any rate, with a double-byte or multi-byte locale code page, you'd have the same issues.

Dave

Reply via email to