String Text = "This is example ”Text”";
Text = WebUtility.HtmlDecode(Text);
System.IO.File.WriteAllText(@"c:\x.txt", Text, Encoding.ASCII);
正确输出:
This is example ”Text”
输出x.txt:
This is example ?Text?
答案 0 :(得分:0)
您可以使用“iso-8859-1”编码:
更改
System.IO.File.WriteAllText(@"c:\x.txt", Text, Encoding.ASCII);
与
System.IO.File.WriteAllText(@"c:\x.txt", Text, Encoding.GetEncoding(28591));