TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Damodar
NA
56
0
Find out the encoding in an xml file using C#
Aug 6 2010 12:15 PM
Hello all,
I have an xml file which shows that the encoding in it is "encoding utf-16" but it is actually saved in utf-8. Actually saved means when i open the xml in a notepad and do saveas i get utf-8 in the encoding part in the save as window.
Now what I have to do is to write a program which first checks whether the encoding in the system is utf-8 or utf-16. If it is utf-8 then it has to change that to utf-16.
I tried using the Encoding to find out but it was showing me the encoding mentioned in the file, but i want the encoding in which the actual xml file is. i used
xmltextreader reader = new xmltextreader ("file");
encoding encode = reader.encoding; // this gives me the encoding in the file.
Will System.Text.Encoding class help me in this regard. Or should i use some System property to check the encoding of the xml file..
Please help me. Thank you in advance.
Reply
Answers (
0
)
Dynamically changing datagridview
Null Exception - No Active Form