locked
XML ISO encoding error RRS feed

  • Question

  • I have created a PDA application but am getting an error when reading an XML file.

     

    The header of the XML file is <?xml version="1.0" encoding="ISO-8859-1" ?>

     

    A section of the code is:

     

    Dim reader As XmlTextReader = New XmlTextReader(filename)

    While reader.Read()

    'do something 

    End While

     

    The error I'm getting is when I perform the read() method, it's throwing an XML exception stating: "System does not support 'ISO-8859-1' encoding".

     

    The same code works fine within a standard Windows application, am I missing a particular reference from the project?

     

    Thanks

    Tuesday, July 17, 2007 10:38 AM

Answers

  • Luckily for me the ISO encoding for the xml file was not a fixed requirement.  I changed it to UTF-16 and things worked fine now.
    Wednesday, July 18, 2007 5:36 PM

All replies

  • That's strange, because ISO-8859-1 encoding is natively supported by the .NET Framework regardless of platform.  (See the System.Text.Encoding documentation.)  I wouldn't think it would be case-sensitive, but you might see what happens if the encoding name is in lower case, as it is in the table in the docs.
    Tuesday, July 17, 2007 11:06 AM
  • Hi Rob,

    Thanks for the help but unfortunately I'm still getting the error even though I've changed the header so it's lowercase. I'm just wondering if I'm missing something from the project settings because it runs fine if I create a new Windows application, I only seem to be getting the problem when creating a Pocket PC Device application.

    Tuesday, July 17, 2007 11:27 AM
  • I have the same problem.  .NET CF application is unable to read iso-8859-1 encoded xml.  Any progress?
    Tuesday, July 17, 2007 6:50 PM
  • No luck whatsoever, I've left it for the time being

    If anyone could offer any help that would be appreciated.

    Wednesday, July 18, 2007 1:01 PM
  • Luckily for me the ISO encoding for the xml file was not a fixed requirement.  I changed it to UTF-16 and things worked fine now.
    Wednesday, July 18, 2007 5:36 PM
  • ^
    Thursday, July 19, 2007 1:40 PM
  • As in the above answer I managed to fix the problem by changing the XML encoding to UTF-8. UTF-16 doesn't work so I don't know if the problem has occurred due to the PDA being a few years old.
    Monday, July 23, 2007 1:28 PM