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

被折叠的 条评论
为什么被折叠?



