eterm汉字编码与解码

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

publicbyte[]GetChineseCode(stringchineseChar){varbytes=newbyte[2];varbyteArr=Encoding.GetEncoding(gb2312).GetBytes(chineseChar);varfirst=(byte)(byteArr[0]+0x72);if(first=0x24){first+=0xe;bytes[0]=first;}varsecond=(byte)(byteArr[1]+0x80);bytes[1]=second;if(second=0x2f){if(second=0x32){second-=0xa;bytes[1]=bytes[0];bytes[0]=second;}}returnbytes;}privatebyte[]GetChineseCodeID(byte[]chinesec){varjudge=0x2f=chinesec[0]+0xa&&chinesec[0]+0xa=0x32;varfirst=judge?chinesec[1]:chinesec[0];varsecond=judge?chinesec[0]:chinesec[1];first=(byte)first-0xe=0x24?(byte)(first-0xe):first;first=(byte)(first-0x72);second=judge?(byte)(second+0xa):second;second=(byte)(second-0x80);returnnewbyte[]{first,second};}

1 / 1
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功