Re: Using XmlTextWriter in VC++ App?
"Joseph M. Newcomer" <newcomer@flounder.com> ha scritto nel messaggio
news:j4ctu3p8v17rjjj8rse6je6gvv2l8akk10@4ax.com...
If all you need to do is WRITE an XML file, CStdioFile::WriteString works
really, really
well. It's just text!
There could be subtle things, however.
For example, if you write the text using UTF-16, you must clearly specifiy
that in the encoding field of the XML header.
i.e. if the "standard" widely-used XML header is used, typically like this:
<?xml version="1.0" encoding="UTF-8"?>
... xml nodes ...
...
then, the text file must really be in *UTF-8* format.
I don't know if CStdioFile::WriteString allows UTF-8 writing (I use my
custom routines for that purpose, they convert from UTF-16 [strings inside
the app] to UTF-8 [strings outside the app]; moreover Tom developed a robust
quality class better than CStdioFile, Tom's code can handle everything from
UTF-16/8/ANSI etc. while CStdioFile seems to me a bit broken...).
So, assuming that CStdioFile::WriteString writes text in UTF-16, the XML
header file must explicitly say that accordingly:
<?xml version="1.0" encoding="UTF-16"?>
Giovanni