diff options
author | Guillaume Zajac <guillaume.zajac@linux.intel.com> | 2012-07-16 16:34:38 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2012-07-16 22:41:34 -0500 |
commit | 1710be9c896ac132af27b52a6e95330d6ed254b8 (patch) | |
tree | 04bd14937caf3dd26f8e25cb0aa700bca9403390 /src/util.c | |
parent | 05b8fe4794c487d704c8fc6183b29eed6361e737 (diff) | |
download | ofono-1710be9c896ac132af27b52a6e95330d6ed254b8.tar.bz2 |
util: Fix GSM to UTF8 conversion mechanism
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 17 |
1 files changed, 14 insertions, 3 deletions
@@ -628,8 +628,16 @@ char *convert_gsm_to_utf8_with_lang(const unsigned char *text, long len, c = gsm_single_shift_lookup(&t, text[i]); + /* + * According to the 3GPP specifications 23.038 + * section 6.2.1.1: + * In the case there is no character in the extension + * table, the character of the main default alphabet + * table or the character from the National Language + * Locking Shift Table should be displayed. + */ if (c == GUND) - goto error; + c = gsm_locking_shift_lookup(&t, text[i]); } else { c = gsm_locking_shift_lookup(&t, text[i]); } @@ -647,9 +655,12 @@ char *convert_gsm_to_utf8_with_lang(const unsigned char *text, long len, while (out < res + res_length) { unsigned short c; - if (text[i] == 0x1b) + if (text[i] == 0x1b) { c = gsm_single_shift_lookup(&t, text[++i]); - else + /* See 3GPP 23.038 section 6.2.1.1 */ + if (c == GUND) + c = gsm_locking_shift_lookup(&t, text[i]); + } else c = gsm_locking_shift_lookup(&t, text[i]); out += g_unichar_to_utf8(c, out); |