0

I'm trying to convert a XML document to a XSD via XSD.exe; and it's failing when encountering the British pound symbol (£) as an invalid character.

I quick summary of the XML looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<foo>
  <bar>
     <title>Text text text £5! text text</title>
  </bar>
</foo>

As far as I can tell, the pound symbol is not particularly special and necessary to escape, and the XML is a valid UTF-8 encoded document; but when running xsd.exe the following error occurs at that symbol:

Error: There was an error processing 'test.xml'.
  - Invalid character in the given encoding. Line 562, position 52.

If you would like more help, please type "xsd /?".

Has anyone encountered a similar issue in the past; or have any clues how I can get this to work?

Thanks!

Adam Frisby
  • 358
  • 5
  • 20
  • 3
    What are the *bytes* for the £ character? I suspect it's not actually correctly-encoded. (Look with a binary file editor.) If you can provide a short but complete example so we can try to reproduce it, that would be very helpful. – Jon Skeet Jun 04 '14 at 10:12
  • You are correct - editor had encoded it in ANSI instead of UTF8. Thanks! – Adam Frisby Jun 04 '14 at 10:13
  • 2
    To be pedantic, ANSI is not an encoding. It is the American National Standards Institute. The name was at one time used by Microsoft to refer to encodings such as Windows-1512, which is a Microsoft variant of the international standard ISO 8859-1 (presumably Microsoft bought their copy from ANSI). – Michael Kay Jun 04 '14 at 13:08

1 Answers1

1

Quick resolution: Turned out the file wasn't written to disk encoded as UTF8 - was saved ANSI instead.

Adam Frisby
  • 358
  • 5
  • 20