Jump to content

Recommended Posts

Posted

Hi all, I got a little problem with encoding. I try to transform with XSL stylesheet one XML into another. From the input side I can get either UTF-16 or ANSI. On the output I must have UTF-8 But whatever I tried:The coding stays as I get it in. What's wrong?? Here is the last version I tried.

<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version= "1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="UTF-8" media-type ="application/xml" omit-xml-declaration="yes"/>

Any help is appreciated!Loriot

Posted

So you mean that dispite this <xs:output> element, your output file begins with

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

?Sounds really odd. And what processor are you using?

Posted

Hi,I found out about it. Prosessing is done by msxml parser and this will always answer with UTF-16 np matter what you really do have. The msxml parser is not able to transform encoding mode. So I found at least another solution and feed now UTF-8 already into the parser. the funny thing is, that you definitely have to write the <?xml version="1.0" encoding="UTF-8"?> header inn by yourself. If you do not set <omit-xml-declaration="yes"> you will always get a header og UTF-16 no matter what the file really is. This is really odd!!But if anybody is hanging around in that forum who knows some scripting or so I can use to change encodings in one go with xsl-transformations I am still curious to know.Thanx so far!!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...