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->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