char c = "A";int asciiOfA = (int)c;//字符型的直接转就行了对于汉字,需要根据编码转:
System.Text.Encoding e = System.Text.Encoding.GetEncoding("gb2312");
byte[] bytes = e.GetChars("中国");bytes是"中国"这个字符串的字节码
System.Text.Encoding e = System.Text.Encoding.GetEncoding("gb2312");
byte[] bytes = e.GetChars("中国");bytes是"中国"这个字符串的字节码
如果取汉字,是不是就把汉字分成两部分,分别存在byte[]数组里呢?