as3 ByteArray和.NET 中Byte[] 字节数组的转化

C# 代码有这么一段:

 byte[] bText = System.Text.Encoding.GetEncoding("gb2312").GetBytes(txtMsgValue.Text.Trim());
 string bbText = BitConverter.ToString(bText).Replace("-", "");

AS3 改写:

var bytes:ByteArray =new ByteArray();
 bytes.writeMultiByte(txtMsgValue.text,"gb2312");
 bytes.position=0;
 var bbText:String ="";
while(bytes.bytesAvailable) { bbText+=bytes.readUnsignedByte().toString(16); } bbText=bbText.replace(/-/g,"");//

 

posted @ 2013-04-01 14:01  走路到纽约  阅读(1431)  评论(0编辑  收藏  举报