Friday, July 8, 2011

Missing Semicolon After &#xA0 With XmlWriter

Recently, I ran into this error:

Exception thrown in BuildReports: Invalid syntax for a hexadecimal numeric entity reference. Line 175, position 3159.

This exception was thrown when   was converted into &#xA0 with the missing semicolon instead of  

This was random.  Some   got converted correctly with the semicolon; and some got converted with the missing semicolon.

I was able to fix it with changing the encoding from ASCII to UTF8

XmlWriterSettings settings = new XmlWriterSettings();
settings.Encoding = Encoding.UTF8;

No comments:

Post a Comment