Error opening xml file with ANSI encoding

  • Thread starter Thread starter sjoshi
  • Start date Start date
S

sjoshi

I'm doig a test using XP English with LocalSettings set to Russian.
When trying to open an XML file with ANSI encoding, I get errors. When
I change the encoding to UTF8, I can read the file successfully.

I'm wondering why this happens. Any help is appreciated.

thanks
Sunit
 
sjoshi said:
I'm doig a test using XP English with LocalSettings set to Russian.
When trying to open an XML file with ANSI encoding, I get errors.

What errors, exactly?
When I change the encoding to UTF8, I can read the file successfully.

I'm wondering why this happens. Any help is appreciated.

Does the encoding of the file on disk match the encoding of the file as
specified within the file itself?
 
There is no encoding specified in the declaration and the file was
saved on a XP english original machine with LocalSettings are set to
Russian. If I open the file in VSNet and then do a SaveAs with UTF-8
encoding, it works fine.

That brings me to another question, Is there a way to find the ecoding
of an XML file in .NET ?

thanks
Sunit
 
sjoshi said:
There is no encoding specified in the declaration

That's the problem then. If no encoding is specified in the
declaration, it's assumed to be UTF-8, according to the XML
specification.
and the file was
saved on a XP english original machine with LocalSettings are set to
Russian. If I open the file in VSNet and then do a SaveAs with UTF-8
encoding, it works fine.

That brings me to another question, Is there a way to find the ecoding
of an XML file in .NET ?

Not sure - if you got the XmlDeclaration somehow, you could ask that -
but I don't know whether the encoding is filled in automatically if
it's not present.
 
Back
Top