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 Nedelcho Stanev <ne...@atlanticsky.com> on 2003/06/02 13:25:21 UTC

Fw: xerces and Windows-1251

----- Original Message ----- 
From: Nedelcho Stanev 
To: xerces-c-dev-help@xml.apache.org 
Sent: Monday, June 02, 2003 1:23 PM
Subject: xerces and Windows-1251


Hello all,

In last 2 days i read lot of info in the newsgroups, in maillist , etc
but still this is unclear for me.
May be this is a trifival question here , but  .. :)
i download xerces ( 2.2.0, 2.3.0, etc ) compile it and get example
CreateDOMDocument.
I modify only one line in example and change createTextNode from 
"XML Parsing Tools" to somthing in cyrillic ( "тестов ред").
after this i add lines from DOMPrint example :

DOMWriter         *theSerializer = ((DOMImplementationLS*)impl)->createDOMWriter();

if (theSerializer->canSetFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true))
    theSerializer->setFeature(XMLUni::fgDOMWRTFormatPrettyPrint, true);
static XMLCh*                   gOutputEncoding        = 0;
gOutputEncoding = XMLString::transcode("WINDOWS-1251" );
theSerializer->setEncoding(gOutputEncoding);

XMLFormatTarget *myFormTarget;
myFormTarget = new StdOutFormatTarget();
theSerializer->writeNode(myFormTarget, *doc);

And result is shit :) Windows cannot display this string.
When i use UTF-8 - result is the same - Windows cannot parse file generated with xerces in this case.
When xerces process generated file ( example taken from DOMCount ) all is ok. But i need to visualize
this xml file in Internet Explorer , or to read it with notepad, word, etc.
I read also about ICU ( but when i get xml4c , or follow instructions about building xerces with icu ) 
i got same.

So if someone can explain, how i can do this ? :)

best wishes,
Nedelcho Stanev