Du Dang
2004-08-04 18:11:21 UTC
I tried to convert a block of text from iso-8859-1 to utf-8 but all I got
after the convertion is gibberish.
===============================
FileStream fs = File.Open("text.txt", FileMode.Open, FileAccess.Read);
byte[] b = new byte[length];
fs.Read(b, 0, length);
b = Encoding.Convert(Encoding.GetEncoding(28591), Encoding.UTF8, b);
return System.Text.Encoding.UTF8.GetString(b);
===============================
When I skipped the convertion line ( b = Encoding.Convert ....) the text is
legible but still in iso-8859-9 encoding.
Does anyone know what I'm doing wrong, or know a better way of doing this?
Thanks,
Du
after the convertion is gibberish.
===============================
FileStream fs = File.Open("text.txt", FileMode.Open, FileAccess.Read);
byte[] b = new byte[length];
fs.Read(b, 0, length);
b = Encoding.Convert(Encoding.GetEncoding(28591), Encoding.UTF8, b);
return System.Text.Encoding.UTF8.GetString(b);
===============================
When I skipped the convertion line ( b = Encoding.Convert ....) the text is
legible but still in iso-8859-9 encoding.
Does anyone know what I'm doing wrong, or know a better way of doing this?
Thanks,
Du