Microsoft KB Archive/317505

= Letter &quot;i&quot; problems occur when you use the XML encoding with Turkish settings =

Article ID: 317505

Article Last Modified on 3/10/2006

-

APPLIES TO


 * Microsoft ADO.NET 2.0
 * Microsoft .NET Framework 1.1 Service Pack 1

-



This article was previously published under Q317505



This article refers to the following Microsoft .NET Framework Class Library namespaces:
 * System.Data
 * System.Xml



SYMPTOMS
If the header of an Extensible Markup Language (XML) file specifies an encoding type that contains a lowercase &quot;i,&quot; and if you are running a Turkish version of Microsoft Windows, you receive the following error message when you try to read the XML into a DataSet object:

An unhandled exception of type 'System.Xml.XmlException' occurred in system.xml.dll

Additional information: System error.

If you catch this exception in a try...catch block, you receive information that is similar to the following:

The system does not support 'ascXX' encoding. Line 1, position 31. Press any key to continue



CAUSE
When the Microsoft .NET Framework parses the XML file, the encoding type in the header is converted to uppercase before the header is processed. This problem occurs because the Turkish alphabet has two distinct letters that resemble a dotted letter &quot;i&quot; and an undotted letter &quot;i.&quot; Windows treats the English lowercase letter &quot;i&quot; as a different Turkish letter than the English uppercase letter &quot;I.&quot;



RESOLUTION
To resolve this problem, use uppercase letters for the encoding type in the XML header. This ensures that all valid encoding types are recognized on computers with either Turkish settings or non-Turkish settings.



Steps to Reproduce the Behavior
NOTE: This sample assumes that you are using a Turkish version of Microsoft Windows.   Open Notepad, and then create a new XML file with the following code:   ALFKI Alfreds Futterkiste Maria Anders <ContactTitle>Sales Representative</ContactTitle> <Address>Obere Str. 57</Address> <City>Berlin</City> <PostalCode>12209</PostalCode> <Country>Germany</Country> <Phone>030-0074321</Phone> <Fax>030-0076545</Fax> ANATR</CustomerID> Ana Trujillo Emparedados y helados</CompanyName> Ana Trujillo</ContactName> <ContactTitle>Owner</ContactTitle> <Address>Avda. de la Constitucion 2222</Address> <City>Mexico D.F.</City> <PostalCode>05021</PostalCode> <Country>Mexico</Country> <Phone>(5) 555-4729</Phone> <Fax>(5) 555-3745</Fax> </myData> </li> <li>Save the file as Test.xml on the root drive or drive C.</li> <li>Start Microsoft Visual Studio .NET.</li> <li>Create a new Console Application in Microsoft Visual C# .NET.</li> <li> Add the following code to the top of your Class1.cs file to import the System.Data and the System.Xml namespaces: using System.Data; using System.Xml; </li> <li> Add the following code in the Main function for Class1: try {   DataSet ds = new DataSet; ds.ReadXml(@&quot;C:\test.xml&quot;); Console.WriteLine(ds.GetXml); } catch(XmlException ex) {   Console.WriteLine(ex.Message); } finally {   Console.WriteLine(&quot;Press ENTER to continue.&quot;); Console.ReadLine; }                   </li> <li> Press F5 to compile and to run your application. Notice that you receive the following error message in the Console window:

The system does not support 'ascXX' encoding. Line 1, position 31.

Resolution
</li> <li>Open Test.xml in Notepad. In the header, change &quot;ascii&quot; to all uppercase, &quot;ASCII&quot;.</li> <li>Save your changes to Test.xml.</li> <li>Return to your project in Visual Studio .NET, and then press F5 to run your project again. Notice that the XML file appears in the Console window.</li></ol>

<div class="references_section">