Re: Question about IXmlWriter WriteRaw(string) and UTF-8
"Frank S" <OldGrouch@community.nospam> wrote in message
news:%23SuIZsQCJHA.1628@TK2MSFTNGP02.phx.gbl
To answer your questions, sXMLData is wstring. It is not UTF-16
however, because I load this string with results previously created
with IXMLWriter.
If it's not UTF-16, what is it? Also, I don't see how "it's not UTF-16"
follows from "created with IXMLWriter".
You were correct about the zero byte problem. This change to the test
code handled that problem:
CString s1(sXMLData.c_str());
CStringA s2;
int nUtf8Size;
s2 = s1;
This doesn't convert to UTF-8, but to the system's default code page. I
suspect you don't see the difference because all your characters are in
fact plain ASCII. You'll have problems when the string contains
international characters.
As far as I can tell, IXmlWriter::WriteRaw should work just fine for
you. Have you actually tried it before concluding you can't use it? If
so, exactly what problem did you encounter with it?
--
With best wishes,
Igor Tandetnik
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925