82 coding for the vernacular

本文介绍了一种通过使用82编码来减少Unicode字符在手机菜单项中占用的空间的方法,这种方法可以有效避免因字符过长导致手机卡顿的问题。

Author: Scruffybear, date: 8-June-2009

The SIM sends out  proactive command which include Unicode to display vernacular language menu item, for example chinese character or India local language, but for unicode, one character will occupy two bytes, the proactive command will easily exceed 255 bytes, when the proactive command is too long, the handset will be hanging. My colleague help me solved this problem by using 82 coding.
The reference for the 82 coding is in GSM11.11 'Annex B', you can go there to check the detail.
example:
80 coding
800D2C0D4B0D330D3F0D350D410D210D4D(this is India local language Malayalam)
transfer to 82 coding
82080D00ACCBB3BFB5C1A1CD
explain as below:
82(coding method) 08(length, begin after the base pointer) 0D00(Base pointer)AC(byte one, offset from the base pointer, here is 0D2C-0D00+80=AC)CB(byte two, here is 0D4B-0D00+80=CB) .... ....  
Just like this, lots of bytes had been saved, for this example, the 80 coding occupys 17 bytes, by using 82 coding 12 bytes, saves (17-12)/17=30% bytes, if there are more characters, i think will save more, because the header part will take less percentage in the whole length.
Someone may ask, why in the calculation of offset have to add 0x80? good question, check the AnnexB, you can find the answer, the original text reads,
'if bit 8 of the octet is set to zero, the remaining 7 bits of the octet contain a GSM Default Alphabet character, whereas if bit 8 of the octet is set to one, the remaining seven bits are an offset value added to the base pointer defined in octets three and four, and the resultant 16 bit value is a UCS2 code point, and defines a UCS2 character.'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值