Android Part Korean mobile phone using KSC5601 code to save contacts, MTK platform phone can not display contact name

Source: Internet
Author: User

According to Spec, the name on the SIM card should be encoded in GSM8 UCS80 81 82.
Some Korean mobile phones (such as older functional machines and Galaxy s) use KSC5601 encoding, outside of spec support.

Now MTK design is to comply with spec:
1. In the modem layer to determine the encoding method is not listed in the spec, not to report the data to the app (which causes the Name field display is empty)
The encoded data in the 2.spec range is converted to UTF16 in the decoding to display

Therefore, the problem is that the contrast machine does not follow the spec to cause, the following solution is a work around method:
Encoding that is not within spec is decoded according to KSC5601


1.modem\l4\phb\src\phb_utils.c

else if (Raw_data[offset] > Coding_ucs2_82)//Add this if statement
{
Kal_uint8 ch1;
Kal_uint8 CH2;
Decoded_str->charset = CHARSET_UCS2;
if (raw_data_len% 2 = = 0)
{
raw_data_len--;
}
for (count = 2; offset < Raw_data_len;)
{
/* exceeds capacity, truncate */
if ((count-1) >= decoded_str->length)
{
Break
}
CH1 = raw_data[offset++];
CH2 = raw_data[offset++];
if (ch1 = = 0xFF && CH2 = = 0xFF)
{
Break
}
decoded_str->data[count++] = CH1;
decoded_str->data[count++] = CH2;
}
Decoded_str->data[0] = 0xFE;
DECODED_STR-&GT;DATA[1] = 0XFE;
}
Else
{
return 0;
}
2. Iccprovider.java (frameworks\base\core\telephony\ ...)
A, the following package is introduced: Import java.io.UnsupportedEncodingException;
B
The Loadrecord function, in the following statement:
CONTACT[0] = index;
CONTACT[1] = Alphatag;
CONTACT[2] = number;
Then add the following statement:
if (Alphatag.length () >= 2 && alphatag.charat (0) = = ' \ufefe ') {
String STRKSC = "";
try{
byte[] InData = alphatag.substring (1). GetBytes ("Utf-16be");
STRKSC = new String (InData, "KSC5601");
} catch (Unsupportedencodingexception ex) {
LOG.E (TAG, "implausible unsupportedencodingexception", ex);
}
CONTACT[1] = STRKSC;
LOG.I (TAG, "decode using KSC5601");

}

Android Part Korean mobile phone using KSC5601 code to save contacts, MTK platform phone can not display contact name

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.