0
// test code
void Start()
{
// bytes is get from server with NetworkStream.Read()
byte[] bytes = { 0xe9, 0xba, 0xbb, // 麻
0xe9, 0xa3, 0x8e, // 風
0xe4, 0xbe, 0x8f, // 侏
0xe5, 0x84, 0x92, // 儒
0x00, 0x00, 0x00,
0x00, 0x00, 0x31,
0x32, 0x00, 0x00,
0x00, 0x00, 0x00 };
// print: 麻風侏儒
Debug.Log(Encoding.UTF8.GetString(bytes, 0, bytes.Length));
}
爲什麼最後沒有解析12個字節,以及如何Encoding.UTF8.GetString
處理UTF-8字節,我的意思是它是如何計算這是否是一箇中國字或它被解析的ASCII字符Encoding.UTF8.GetString解析錯誤?
Unity3D單聲道是'MyString.ToCharArray()',謝謝! – Maadiah