Re: [xml] xmlSaveToFilename with UTF-8 encoding



Hi Martin and Daniel,

[quote from Martin's reply]

Does this problem occur always for you, even with the example files?
What encoding is written into the xml header?

I haven't tried the example files yet but will do this.

The original XML file has a UTF-8 header and is properly encoded in UTF-8 (if you look at it with an hex 
viewer) with a UTF-8 BOM sequence.

The same goes for the XSL file; the "xsl:output encoding" is set to UTF-8.

But the resulting file is encoding in ANSI....


[quote from Daniel's message]

  the proper way is to indicate the encoding in the stylesheet and
use the XSLt related serialization routines 

  e.g. http://xmlsoft.org/XSLT/tutorial/libxslttutorial.html#saveresult

Originally, I used the xsltSaveResultToFileName() function, until I realized that the resulting file is not 
encoded as UTF-8. Then I searched you library and found the xmlSaveFileEnc() or xmlSaveToFilename() functions 
where the encoding can be passed as a parameter.
But none of these functions seem to work for me.

Maybe I should add that I'm working on Windows and use the Delphi/Pascal version of libxml2.

Any other tips on how to force the right encoding?

BTW: another question but related to this topic
Is there any way to force a "Save data to file" - function/procedure to add a UTF-8 BOM sequence to be added 
at the beginning of the file?

Thanks.

best wishes,
Michael

_______________________________________________________________
SMS schreiben mit WEB.DE FreeMail - einfach, schnell und
kostenguenstig. Jetzt gleich testen! http://f.web.de/?mc=021192




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]