Hi Ganesh On 11/29/2010 02:45 PM, Ganesh Pagade wrote:
I have a C++ string which is in UTF-8, which I am passing to XMLString::transcode(). However XMLString::transcode() is expecting SJIS (Japanese). So it returns garbage characters in XMLCh*.
Which of the XMLString::transcode methods are you calling? I think this one: http://xerces.apache.org/xerces-c/apiDocs-2/classXMLString.html#392a86c9a310dff366bedf2330050c3b has a buggy description (shouldn't it read: "Transcodes a string *from* native code-page"??) and the expected input string format is platform dependent.
So I tired using XMLUTF8Transcoder. However XMLUTF8Transcoder's transcodeTo() expects XMLCh*. How do I convert C++ string into XMLCh* without using the XMLString::transcode(), so that I can pass it to transcodeTo()? Or how do I make XMLString::transcode() expect UTF-8? Any suggestions/pointers would be highly appreciated.
People on this list have told me (Sat, 24 Jul 2010 10:48:38 -0700) that XMLCh is UTF-16 with platform byte order. So converting char* to XMLCh* equals converting char* to UTF-16 (with platform byte order). You should be able to do it with iconv (which is POSIX.1-2001 conforming) or, if you need any more sophisticated string operations, you might want to use ICU: http://userguide.icu-project.org/strings . STF
