in 未分类

82 coding for the vernacular

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.
80 coding
800D2C0D4B0D330D3F0D350D410D210D4D(this is India local language Malayalam)
transfer to 82 coding
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.’

Write a Comment