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 "Alberto Massari (JIRA)" <xe...@xml.apache.org> on 2005/08/04 15:35:57 UTC

[jira] Resolved: (XERCESC-1468) Wrong encoding in output

     [ http://issues.apache.org/jira/browse/XERCESC-1468?page=all ]
     
Alberto Massari resolved XERCESC-1468:
--------------------------------------

    Resolution: Invalid

Hi Manfred,
the behaviour of DOMWriter is correct: the DOM specs require writeToString to use UTF-16 as encoding

> Wrong encoding in output
> ------------------------
>
>          Key: XERCESC-1468
>          URL: http://issues.apache.org/jira/browse/XERCESC-1468
>      Project: Xerces-C++
>         Type: Bug
>   Components: DOM
>     Versions: 2.6.0
>     Reporter: Manfred Egger

>
> Add the following Code to the CreateDOMDocument example on Line #175:
> DOMWriter *writer = impl->createDOMWriter();
>  if (writer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint,1)) {
>    writer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint,1);
> }
> writer->setEncoding(XMLUni::fgISO88591EncodingString2);
> StdOutFormatTarget target ;
> writer->writeNode(&target,*doc);
> writer->release();
> Now you should get the following output:
> <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
> <company>
>   <product>Xerces-C</product>
>   <category idea="great">XML Parsing Tools</category>
>   <developedBy>Apache Software Foundation</developedBy>
> </company>
> If you now replace the two lines
> StdOutFormatTarget target ;
> writer->writeNode(&target,*doc);
> with
> std::cout << XMLString::transcode(writer->writeToString(*doc));
> then you should get the same content as above but with encoding="UTF-16" which is wrong.
> How can this problem be solved?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: c-dev-help@xerces.apache.org