Converting problem ANSI to UTF8 C#

前端 未结 7 1652
借酒劲吻你
借酒劲吻你 2021-01-17 20:08

I have a problem with converting a text file from ANSI to UTF8 in c#. I try to display the results in a browser.

So I have a this text file with many accent characte

相关标签:
7条回答
  • 2021-01-17 20:47

    This is probably the easiest way:

    byte[] ansiBytes = File.ReadAllBytes("inputfilename.txt");
    var utf8String = Encoding.Default.GetString(ansiBytes);
    File.WriteAllText("outputfilename.txt", utf8String);
    
    0 讨论(0)
提交回复
热议问题