Encoding - converter
Filed in C# on May.09, 2008
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.
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.
Related posts:






















