Answers
Apr 09, 2007 - 02:15 PM
http://www.codeproject.com/useritems/...
Cheers
Peter
Apr 09, 2007 - 02:15 PM
Apr 11, 2007 - 08:37 PM
I was actually looking for a generic, not programming way of detecting the file encoding, but I didn't find that yet.
What I did find by testing with different encodings was that my text was UTF-7.
So where I first was doing:
StreamReader file = File.OpenText(fullfilename);
I had to change it to:
StreamReader file = new StreamReader(fullfilename, System.Text.Encoding.UTF7);
OpenText assumes it's UTF-8.
you can also create the StreamReader like this
new StreamReader(fullfilename, true), the second parameter meaning that it should try and detect the encoding from the byteordermark of the file, but that didn't work in my case.
Apr 12, 2007 - 11:45 AM
if(file.Encoding == System.Text.Encoding.UTF7)
{
[...]
}
Would be nice. Well, maybe in.Net Framework 4.0?
Cheers for the points!
Peter
Jul 24, 2007 - 09:52 AM
Jan 16, 2009 - 04:49 PM
Add New Comment