473,387 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error opening xml file with ANSI encoding

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

Nov 17 '05 #1
3 3023
sjoshi <sj****@ingr.com> wrote:
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?

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #2
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

Nov 17 '05 #3
sjoshi <sj****@ingr.com> wrote:
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.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: aa | last post by:
Is it OK to include an ANSI file into a UTF-8 file?
9
by: wordsender | last post by:
Hey guys, I can't figure this one out, why is this simple script giving me problems? logfile=file(r'test.txt','w') logfile.write('datetime') test=logfile.readlines() When I run it I get...
6
by: dbaldi | last post by:
(this is follow-on message to one posted yesterday) I'm trying to reproduce the capabilities in both Notepad and Excel, whereby a Unicode text file with Unicode characters can be converted to...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
7
by: Drew Berkemeyer | last post by:
Hello, I'm using the following code to read a text file in VB.NET. Dim sr As StreamReader = File.OpenText(strFilePath) Dim input As String = sr.ReadLine() While Not input Is Nothing...
2
by: Nikolay Petrov | last post by:
How to read ANSI text. The sream reader reads only UTF-8
1
by: Jeff User | last post by:
Hi all C#, .net1.1, plain old aspx page with nothing on it. The aspx page is named ViewComments.aspx I read a clob column from an Oracle db. then I send it to the Response out like...
7
by: firepol | last post by:
Hello there, I am dealing with files encoded in UTF8 and I can't find a way to convert them into ANSI. I've already searched in google for this since a while, and I'm not achieving the result I...
0
by: rajana | last post by:
Dear All, We have Ansi file with german characters (Ä / Ø) , We are using Streamreader to read the contents of the file. But Readline() not able to read the German characters. We tried all...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.