C# Byte[] Byte array to Unicode string
I need very fast conversion from byte array to string. Byte array is Un开发者_Go百科icode string.
From byte[]
array to string
var mystring = Encoding.Unicode.GetString(myarray);
From string
to byte[]
var myarray2 = Encoding.Unicode.GetBytes(mystring);
Try this
System.Text.UnicodeEncoding.Unicode.GetString
UTF8 (I think you mean "UTF8" instead of "Unicode"). Because, U'll get just Chinese Symbols. ;)
Maybe it helps to change...
var mystring = Encoding.Unicode.GetString(myarray);
...to...
var mystring = Encoding.UTF8.GetString(myarray);
:)
精彩评论