给定一个带有非 unicode 文本的 txt 文件,我能够将其字符集检测为1251。现在,我想转换成unicode。
byte[] bytes1251 = Encoding.GetEncoding(1251).GetBytes(File.ReadAllText("sampleNU.txt"));
String str = Encoding.UTF8.GetString(bytes1251);
这行不通。
这是非 unicode 到 unicode 转换的方法吗?
在对 RTF 文件尝试了建议的方法后,当我尝试打开输出 RTF 文件时,会出现以下对话框。请让我知道该怎么做,因为选择 Unicode 不会使其可读或给出预期的文本?