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,"");//