Quantcast
Channel: Sage 50 US
Viewing all articles
Browse latest Browse all 18012

Forum Post: Sage 50 COM API exporting XML

$
0
0
Hi, I don't know if anyone else has come across this issue. If your users add a UTF-8 character e.g. a registered trademark symbol to the note field of an invoice, the character is created as is in the in the output file as it. If you try to load this using XmlTextReader you will get an exception stating that there is an "invalid character in the given encoding". However, there is a simple solution to this and that is toload the Sage XML file using a StreamReader and specifying UTF-8 as the encoding. e.g. using (var stream = new StreamReader(string.Format("{0}\\{1}", dataDirectory, FileName), Encoding.UTF8)){ XDocument xDocument = XDocument.Load(stream); // other code here ... } This basically covers the issue and removes the exception. HTH CR

Viewing all articles
Browse latest Browse all 18012

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>