Coding Platform: ASP.NET WebForms 4.0 with C#
Background: I am reading some values from XML and everything was working in my locale (en-US). The XML looks like this
<?xml version="1.0" encoding="utf-32" ?>
<settings>
<UserRegistration>AutoAuthorize</UserRegistration>
<OpenIDProfile>PromptUser</OpenIDProfile>
<EnableSpamProtection>Yes</EnableSpamProtection>
<MaxAllowedOpenID>2</MaxAllowedOpenID>
<WebsiteURL>http://localhost:70707/blah/</WebsiteURL>
<FacebookOAuthURL>https://graph.facebook.com/oauth/authorize?</FacebookOAuthURL>
<FacebookAccessTokenURL>https://graph.facebook.com/oauth/access_token?</FacebookAccessTokenURL>
<FacebookRedirectPage>ausgefüllt.aspx</FacebookRedirectPage>
<FacebookAppID>192328104139846</FacebookAppID>
<FacebookAppKey>29daeb58d8ae84cc22181f4073e4ed9d</FacebookAppKey>
<FacebookAppSecret>b94e9ddd20efc47b3227e7333925fdd8</FacebookAppSecret>
<FacebookScope>email</FacebookScope>
<EmailSettingsDisplayName>admin</EmailSettingsDisplayName>
<EmailSettingsEmail>blah@blah.com</EmailSettingsEmail>
<EmailSettingsPassword>192185135098207157230060249027191124199097098215</EmailSettingsPassword>
</settings>
Problem
I wrapped the whole thing to my client for testing. The testing environment is
Server: Windows Server 2008 R2 64 bit
Locale: German (de-DE)
And now, when I try to read the XML, Elmah throws two errors error. The first error is
System.Xml.XmlException: '', hexadecimal value 0xA000D, is an invalid character. Line 1, position 40. at System.Xml.XmlTextReaderImpl.Throw(String res, String[] args) at System.Xml.XmlTextReaderImpl.ParseRootLevelWhitespace() at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at System.Xml.Linq.XDocument.Load(XmlReader reader, LoadOptions options) at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options) at Administrator_SiteSettings.SaveSettingsButton_Click(Object sender, EventArgs e) in c:\Webs\ThirdPartyLogins\Administrator\SiteSettings.aspx.cs:line 48
I am taking these XML node values to a Dictionary and this error follows with a key not found error for the dictionary.
Is encoding the culprit?
What could be wrong in my code?
Update: Just read UTF-8, UTF-16, and UTF-32. Will changing to utf-8 help?
Update2: Two things that might clarify the issue more.
1) On changing the encoding to utf-16, got a new error
at utf-16 its System.Xml.XmlException: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 39.
2) The XML pasted earlier was not complete. It had some more nodes with some URL as node data. Will that be an issue? Have updated XML also.