Hi i have a lot of ANSI encoded files in the same folder with different extensions and i want to convert all this files into utf-8 encoded files
so how can i do this in c#

Thank you

Hey there,
In order to convert all of your ANSI encoded files to utf-8, you first need to get a list of your files in folder. After that you could use this code snippet..

StreamReader sr = new StreamReader(infile);  

StreamWriter sw = new StreamWriter(outfile, false, Encoding.UTF8);  
sw.WriteLine(sr.ReadToEnd);  

sw.Close();  
sr.Close();

Hope i helped. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.