Tuesday, August 25, 2015

Convert Ascii file to UTF-8 or other file formats

C# code to convert the ASCII file to UTF-8 or other formats


StreamReader sr = new StreamReader(infile);  
StreamWriter sw = new StreamWriter(outfile, false, Encoding.ASCII); // or UTF-7, etc  
 
sw.WriteLine(sr.ReadToEnd);  
 
sw.Close();  
sr.Close();