1
在C#中,我們如何轉換的byte []字符串與charset.eg UTF8,SHIFT_JIS,多 。我知道Encoding.UTF8C#轉換字節[]到字符串字符集
byte[] inputBytes =SupportClass.ToByteArray(readBytes);
StringBuilder result;
result.Append(System.Text.Encoding.UTF8.GetString(inputBytes,0,inputBytes.Length));//get unreadable code.
我問題是我怎麼能知道檢查結果從inputBytes用特殊字符集,像java
StringBuffer result.append(new String(buffer, "SJIS"));
很好的回答,但是當我使用System.Text.Encoding.GetEncoding( 「GB18030」),似乎沒有fire.what是錯的,確實需要編碼名稱「gb2312」,但在您的鏈接頁面中找不到此編碼名稱;這讓我感到困惑。 – 2012-03-06 03:35:25
GB18030和GB2312都可以與GetEncoding(http://msdn.microsoft.com/en-us/library/system.text.encodinginfo.getencoding.aspx)一起使用 - 請澄清您面臨的問題(可能存在一個新問題)。 – 2012-03-06 03:45:42
在wp7中,gb2312不支持! – 2012-03-09 02:31:34