Discussion:
XSLTransform fails on 0xA0 character with UTF-8
(too old to reply)
Trillium
2005-07-07 20:25:04 UTC
Permalink
I am trying to transform an XML file which has an attribute value that
includes the character 0xA0 (decimal 160) with the error message:
There is an invalid character in the given encoding.
The file has encoding="UTF-8" in the xml declaration. I tried using
Xselerator to do the transform (which uses msxml 4), which it does not
produce an error, and validating it returns valid.

I am not very familiar with encodings, but I believe that UTF-8 should allow
for non-ascii characters(?). And I am not sure why I would get a different
result running the transform with XslTransform file in a .net application
(which I assume would use the msxml parser) than the msxml parser as used by
Xselerator.

Any ideas?
Julian F. Reschke
2005-07-07 21:13:24 UTC
Permalink
Post by Trillium
I am trying to transform an XML file which has an attribute value that
There is an invalid character in the given encoding.
The file has encoding="UTF-8" in the xml declaration. I tried using
Xselerator to do the transform (which uses msxml 4), which it does not
produce an error, and validating it returns valid.
I am not very familiar with encodings, but I believe that UTF-8 should allow
for non-ascii characters(?). And I am not sure why I would get a different
result running the transform with XslTransform file in a .net application
(which I assume would use the msxml parser) than the msxml parser as used by
Xselerator.
Any ideas?
If the file declares an encoding of "UTF-8", and you actually have a
0xA0 byte in it, then it's most certainly UTF-8 but something like
ISO-8859-1, and the XML parser is just doing doing what it's supposed to
do, i.e., reporting the invalid byte sequence.

(The Unicode character 0xA0 encoded correctly in UTF-8 would be a
multi-byte sequence).

Best regards,

Julian

Loading...