Fri
9
May '08
Here is a sample code in c# to convert a file with UTF-7 encoding to ISO-8859-1 encoding. You can change these values to make any to any converter.
Make sure you imported System.IO.
Encoding FromEnc = Encoding.UTF7; // from
Encoding ToEnc = Encoding.GetEncoding(“ISO-8859-1″); //to
TextReader tr = new StreamReader(@“C:\from.html”, FromEnc);
TextWriter tw = new StreamWriter(@“C:\to.html”,false, ToEnc);
tw.Write(tr.ReadToEnd());
tr.Close();
tw.Close();
Make sure you imported System.IO.

Leave a passing comment »