Currently, the source code of the program must be in the UTF8 format. Therefore, you need to convert the original source code. manual conversion is obviously too tired.
It's really easy to find c #, just a few lines of code. I tried converting GBK to UTF8 encoding format. It's okay.
Static void Main (string [] args)
{
String dir, filters;
Console. WriteLine ("Please input the directory :");
Dir = Console. ReadLine ();
Console. WriteLine ("Please input the filter (such as *. c, *. cpp ):");
Filters = Console. ReadLine ();
Console. WriteLine ("The following files will be converted :");
List <string> destfiles = new List <string> ();
Foreach (string filter in filters. Split (','))
{
Foreach (var eachfileinfo in new DirectoryInfo (dir). GetFiles (filter, SearchOption. AllDirectories ))
{
Destfiles. Add (eachfileinfo. FullName );
Console. WriteLine (eachfileinfo. FullName );
}
}
Console. WriteLine ("You Sure? (Y or n )");
String ans = Console. ReadLine ();
If (ans. Equals ("y", StringComparison. OrdinalIgnoreCase ))
{
Foreach (string destfile in destfiles)
{
File. WriteAllText (destfile, File. ReadAllText (destfile, Encoding. Default), Encoding. UTF8 );
}
Console. WriteLine ("finished .");
}
Else
{
Console. WriteLine ("Nothing changed .");
}
Console. WriteLine ("Press any key to exit .");
Console. ReadLine ();
}