Skip to content

Instantly share code, notes, and snippets.

@koba-yu
Last active May 2, 2020 06:17
Show Gist options
  • Save koba-yu/dd635d8bdf3c232f184814b48cdb97fc to your computer and use it in GitHub Desktop.
Save koba-yu/dd635d8bdf3c232f184814b48cdb97fc to your computer and use it in GitHub Desktop.
C#で指定フォルダのファイルを全てShift-JISからUTF-8に変換する
void Main()
{
foreach (var file in Directory.EnumerateFiles(@"ここにフォルダを指定"))
{
var content = File.ReadAllText(file, Encoding.GetEncoding("Shift_JIS"));
if(content.Length == 0)
continue;
File.WriteAllText(file, content, Encoding.GetEncoding("UTF-8"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment