Letter "i" problems occur when you use the XML encoding with Turkish settings (317505)



The information in this article applies to:

  • Microsoft ADO.Net 2.0
  • Microsoft ADO.NET (included with the .NET Framework)

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 "i," 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 "i" and an undotted letter "i." Windows treats the English lowercase letter "i" as a different Turkish letter than the English uppercase letter "I."

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.

MORE INFORMATION

Steps to Reproduce the Behavior

NOTE: This sample assumes that you are using a Turkish version of Microsoft Windows.
  1. Open Notepad, and then create a new XML file with the following code:
    <?xml version="1.0" encoding="ascii"?>
    <myData>
      <cust>
        <CustomerID>ALFKI</CustomerID>
        <CompanyName>Alfreds Futterkiste</CompanyName>
        <ContactName>Maria Anders</ContactName>
        <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>
      </cust>
      <cust>
        <CustomerID>ANATR</CustomerID>
        <CompanyName>Ana Trujillo Emparedados y helados</CompanyName>
        <ContactName>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>
      </cust>  
    </myData>
    					
  2. Save the file as Test.xml on the root drive or drive C.
  3. Start Microsoft Visual Studio .NET.
  4. Create a new Console Application in Microsoft Visual C# .NET.
  5. 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;
    					
  6. Add the following code in the Main function for Class1:
    try
    {
    	DataSet ds = new DataSet();
    	ds.ReadXml(@"C:\test.xml");
             Console.WriteLine(ds.GetXml());
    }
    catch(XmlException ex)
    {
    	Console.WriteLine(ex.Message);
    }
    finally
    {
    	Console.WriteLine("Press ENTER to continue.");
    	Console.ReadLine();
    }
    					
  7. 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

  8. Open Test.xml in Notepad. In the header, change "ascii" to all uppercase, "ASCII".
  9. Save your changes to Test.xml.
  10. 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.

REFERENCES

For more information about localization issues that involve the Turkish letter "i," see the Dr. International column at the following Microsoft Web site:

Modification Type:MajorLast Reviewed:3/10/2006
Keywords:kbtshoot kberrmsg kbnofix kbprb kbSystemData KB317505 kbAudDeveloper