Free Support Forum - aspose.com

Invalid character in the given encoding

I’m using DLL version 1.5.17

Here is the line throwing the error:
PERRIER-JOU?T

Here is the error being thrown:
[XmlException: There is an invalid character in the given encoding. Line 567, position 76.]
System.Xml.XmlScanner.GetChars(Byte[] srcBuffer, Int32& srcOffset, Int32 srcLen, Char[] destBuffer, Int32 destOffset, Boolean zeroedOut) +268
System.Xml.XmlScanner.Read() +139
System.Xml.XmlScanner.ScanContent() +412
System.Xml.XmlTextReader.ParseBeginTagExpandCharEntities() +262
System.Xml.XmlTextReader.Read() +216
System.Xml.XmlValidatingReader.ReadNoCollectTextToken() +38
System.Xml.XmlValidatingReader.Read() +14
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +33
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadCurrentNode() +192
System.Xml.XmlLoader.LoadChildren(XmlNode parent) +47
System.Xml.XmlLoader.LoadElementNode() +144
System.Xml.XmlLoader.LoadCurrentNode() +38
System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc) +49
System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace) +102
System.Xml.XmlDocument.Load(XmlReader reader) +72
System.Xml.XmlDocument.Load(String filename) +78
Aspose.Pdf.Pdf.BindXML(String xmlFile, String xslFile) +38


I think the problem is having characters over the letter. For example, the line throwing the error has an umlat over the E (PERRIER-JOU?T). The error also is thrown with accent character. For example, the accent character over the e (Cuvée) throws the error.

Dear dgertz,

Thanks for your consideration.

I have tested your xml line and have not found any error.

According to your error message, the exception is a XmlException. Please make sure the encoding setting in your xml file is correct.

How did you test the xml line? The error is occuring in the BindXML function. I’ve tried a number of differnect fontEncodings, but with no luck. How did / what did you do to get the line to generate?

Please disregard last post. I was able to correct the issue.

Do you remember how you did correct this issue? I’m running into the same problem…