Norwegian Characters Crashes the xslt Load()

It's not only Al Quaida (or whatever spelling that is) that have something against Norwegians these days.

The System.Xml.Xsl.XslTransform also dislikes norwegian stuff. Putting an Æ Ø or Å into a comment section of an xslt stylesheet causes the function to crash with the error message:

An unhandled exception of type 'System.ArgumentException' occurred in system.xml.dll
Additional information: Invalid byte was found at byte index XX.

This especially sucks when my name includes an Ø and I'd like to tag my name to my work. Another two hours wasted in the hard learning of xsl transformations. *Grumpy*

Comments

# Paul Nicholls said:

From http://www.w3schools.com/xml/xml_encoding.asp -

To avoid this error you can add an encoding attribute to your XML declaration, but you cannot use Unicode.

Are you setting an encoding type? The w3schools article is talking about XSL in IE5, but it would be logical to assume the "problem" carries over to .net

Friday, May 23, 2003 12:00 AM
# Mads said:

Actually, I've tried with every possible kind of encoding. utf-8/utf-16/unicode/windows-1265 etc. Doesn't seem to matter. This only occurs for the text inside the comment section though.

Friday, May 23, 2003 1:04 AM
# Paul Nicholls said:

Hmm, strange - I tested it with your examples inside a comment, and utf-8/iso-8859-1 didn't give me an exception (but the others did, of course).

Friday, May 23, 2003 1:38 AM
# Sondre Bjellås said:

You might want to try to save the file with unicode support, and not just change the XML header, play around with the the Advanced Save option in Visual Studio .NET

I'm from Norway to, and I usually only use UTF-8 was it makes filesizes much smaller, and most characters can be encoded using numbers, like ø

It's hard to understand all this encoding stuff, but I found this URL to be very helpfull: http://www.yale.edu/pclt/encoding/


Take care,
Sondre / www.fanms.com

Wednesday, June 11, 2003 5:19 AM
# steve said:

I put the encoding attribute on the xml root element and no more error. Thanks!

Wednesday, May 26, 2004 12:02 AM