The X() macro is a helper class that converts from the local encoding to Unicode; if you have UTF-8 data, you need to use instead the UTF-8 transcoder.

Alberto

At 02.40 18/05/2007 -0700, Mihai Matei wrote:
Hi,

I'm trying to add the attached file's contents to a CDATA section in an xml. It contains a few Unicode-UTF8 characters from <http://www.columbia.edu/kermit/utf8-t1.html>http://www.columbia.edu/kermit/utf8-t1.html. (you can view the file with Firefox, set the Character Encoding to Unicode(UTF8)).

//string 'text' has the contents;
//if I output it to a file with ofstream, the UTF8 characters are preserved

DOMElement* pText = pDoc->createElement( X(tag.c_str()));
DOMCDATASection* pCdata = pDoc->createCDATASection(X(text.c_str()));
pText->appendChild(pCdata);
parent->appendChild(pText);

the resulting xml however loses the UTF-8 characters. Is it the X() macro that is to blame, or can I set other XML Document properties so I keep my UTF8 chars?

Thanks.


Got a little couch potato?
Check out fun <http://us.rd.yahoo.com/evt=48248/*http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz>summer activities for kids.



Ready for the edge of your seat? <http://us.rd.yahoo.com/evt=48220/*http://tv.yahoo.com/>Check out tonight's top picks on Yahoo! TV.

Reply via email to