You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by ddt <dd...@drac.com> on 2003/04/04 19:09:14 UTC
Trouble with encodings
Hi,
I've found several problems using Xerces-Perl, when the strings had any
iso-8859-1 specific character the string disappeared, so I tried to reproduce
it in c++ with the same results:
I commented and added this lines in the samples/DOMPrint.cpp
// get the DOM representation
//DOMNode *doc = parser->getDocument();
DOMDocument *doc = parser->getDocument();
DOMElement* rootElem = doc->getDocumentElement();
DOMElement* asciiElem =
doc->createElement(XMLString::transcode("generatedasciitext"));
DOMText* asciiDataVal = doc->createTextNode(XMLString::transcode("Traca"));
asciiElem->appendChild(asciiDataVal);
rootElem->appendChild(asciiElem);
DOMElement* nonasciiElem =
doc->createElement(XMLString::transcode("generatednonasciitext"));
DOMText* nonasciiDataVal = doc->createTextNode(X("Traça"));
nonasciiElem->appendChild(nonasciiDataVal);
rootElem->appendChild(nonasciiElem);
I compiled it with no warnings and no errors and used it with that XML file:
<?xml version="1.0" encoding="iso-8859-1" ?>
<root>
<asciitext>aciitext</asciitext>
<nonasciitext>traça</nonasciitext>
</root>
So with xerces 2.1.0 and 2.0.0 I got this result:
./DOMPrint -wfpp=on test.xml
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<root>
<asciitext>aciitext</asciitext>
<nonasciitext>traça</nonasciitext>
<generatedasciitext>Traca</generatedasciitext>
<generatednonasciitext></generatednonasciitext>
</root>
And with xerces 2.2.0 and xerces-2003-03-14 I got this result:
./DOMPrint -wfpp=on test.xml
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
<root>
<asciitext>aciitext</asciitext>
<nonasciitext>traça</nonasciitext>
<generatedasciitext>Traca</generatedasciitext>
<generatednonasciitext>Traer</generatednonasciitext>
</root>
Any way to fix it? or workaround it? bring me some help, I'm desesperated....
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-c-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-c-dev-help@xml.apache.org