开发者

C# Byte[] Byte array to Unicode string

I need very fast conversion from byte array to string. Byte array is Un开发者_Go百科icode string.


C# Byte[] Byte array to Unicode 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);

:)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜