Hmm. Unexpected.

Have you tried the DOMDocument::setEncoding(XMLCh *) method?

Cheers,
        Berin

Milan Tomic wrote:
Berin,


DOMWriter *dw = impl->createDOMWriter();
encNameStr = XMLString::transcode("UTF-8");
dw->setEncoding(encNameString);
XMLCh* xcXML = dw->writeToString(*doc);
char *cXML = XMLString::transcode(xcXML);
delete dw;

Should work.

I've just tried that and still there is:


<?xml version="1.0" encoding="UTF-16" standalone="no" ?>

    line in my output XML document. "UTF-16" should be "UTF-8". The file
was already encoded right even without this line:


dw->setEncoding(encNameString);


    the only problem is first line in my output document which contains
"UTF-16" string. When I change it in notepad ("UTF-16" to "UTF-8")
everything works fine.

Thank you,
Milan






Reply via email to