1
我如何可以將cp1252字符串轉換爲utf-8字符串在c#中? 我嘗試這樣的代碼,但它不工作:cp1252字符串編碼爲utf-8在c#中的字符串
Encoding wind1252 = Encoding.GetEncoding(1252);
Encoding utf8 = Encoding.GetEncoding(1251);
byte[] wind1252Bytes = ReadFile(myString1252);
byte[] utf8Bytes = Encoding.Convert(wind1252, utf8, wind1252Bytes);
string myStringUtf8 = Encoding.UTF8.GetString(utf8Bytes);
'編碼UTF8 = Encoding.GetEncoding(1251);'代碼頁1251是不是UTF8。 – stuartd
'編碼utf8 = Encoding.UTF8;' – Equalsk