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#
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 =newStreamReader(infile);
StreamWriter sw =newStreamWriter(outfile,false, Encoding.UTF8);
sw.WriteLine(sr.ReadToEnd);
sw.Close();
sr.Close();
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.