之前看过一个帖子
该模块用于emoji编码转换,不过略有缺陷,参考其结构进行改造,精简
emoji表情的编码android和ios两种操作系统的使用的码元不一样,本模块实现同时兼容两种系统的emoji编码
原理:
VX客户Duan使用的是unicode编码(utf-16le),检测出emoji表情字符或易不能显示的字符,对其使用UCS-4进行编码(使用易自带的编码转换库)
示例:
原始文本:
android数据:{ 4, 226, 100, 0, 97, 0, 42, 227, 118, 86, 62, 216, 129, 221, 82, 224, 98, 86, 98, 86, 80, 224, 60, 216, 8, 223, 62, 216, 37, 221, 53, 0, 53, 0, 52, 0, 62, 216, 32, 221, 87, 93, 244, 78, 51, 109, 40, 98, 62, 216, 36, 221, 53, 0, 54, 0, 106, 0, 104, 0, 102, 0, 70, 226, 106, 0, 104, 0, 102, 0, 100, 0, 75, 226, 60, 216, 245, 221, 60, 216, 249, 221, 17, 229, 168, 88, 92, 149, 60, 216, 248, 221, 60, 216, 236, 221, 60, 216, 225, 223, 253, 78, 80, 91, 177, 148, 60, 216, 220, 223, 201, 98, 201, 98, 228, 136, 49, 0, 50, 0, 51, 0 }
android编码后: [u+E204]da[u+E32A]噶[u+1F981][u+E052]噢噢[u+E050][u+1F308][u+1F925]554[u+1F920]嵗仴洳戨[u+1F924]56jhf[u+E246]jhfd[u+E24B][u+1F1F5][u+1F1F9][u+E511]墨镜[u+1F1F8][u+1F1EC][u+1F3E1]份子钱[u+1F3DC]拉拉裤123
ios数据:{ 61, 216, 159, 220, 100, 0, 97, 0, 61, 216, 153, 220, 118, 86, 62, 216, 129, 221, 61, 216, 54, 220, 98, 86, 98, 86, 61, 216, 47, 220, 60, 216, 8, 223, 62, 216, 37, 221, 53, 0, 53, 0, 52, 0, 62, 216, 32, 221, 87, 93, 244, 78, 51, 109, 40, 98, 62, 216, 36, 221, 53, 0, 54, 0, 106, 0, 104, 0, 102, 0, 79, 38, 106, 0, 104, 0, 102, 0, 100, 0, 206, 38, 60, 216, 245, 221, 60, 216, 249, 221, 60, 216, 234, 221, 60, 216, 248, 221, 168, 88, 92, 149, 60, 216, 248, 221, 60, 216, 236, 221, 60, 216, 225, 223, 253, 78, 80, 91, 177, 148, 60, 216, 220, 223, 201, 98, 201, 98, 228, 136, 49, 0, 50, 0, 51, 0 }
ios编码后:[u+1F49F]da[u+1F499]噶[u+1F981][u+1F436]噢噢[u+1F42F][u+1F308][u+1F925]554[u+1F920]嵗仴洳戨[u+1F924]56jhf[u+264F]jhfd[u+26CE][u+1F1F5][u+1F1F9][u+1F1EA][u+1F1F8]墨镜[u+1F1F8][u+1F1EC][u+1F3E1]份子钱[u+1F3DC]拉拉裤123
NanMuModule.e
(14.42 KB, 下载次数: 220)
|