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