aboutsummaryrefslogtreecommitdiff
path: root/src/mm-charsets.c
diff options
context:
space:
mode:
authorDan Williams <dcbw@redhat.com>2010-04-09 13:50:45 -0700
committerDan Williams <dcbw@redhat.com>2010-04-09 13:50:45 -0700
commit0d381e2f11cbc3bdb7c7e69bc4c7169a9d247d3c (patch)
tree767e21734f1f8287d57df02359bf1339b7c0f8e5 /src/mm-charsets.c
parentb51a9d27e5a793b4e33bfdd7999e7204c408f154 (diff)
gsm: fix CSCS=? parsing and add testcases
Some devices (at least one Blackberry we know about) don't include the () around the response. Handle that and add testcases for it.
Diffstat (limited to 'src/mm-charsets.c')
-rw-r--r--src/mm-charsets.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/mm-charsets.c b/src/mm-charsets.c
index c2fa2298..abe54a1c 100644
--- a/src/mm-charsets.c
+++ b/src/mm-charsets.c
@@ -23,21 +23,22 @@
typedef struct {
const char *gsm_name;
+ const char *other_name;
const char *iconv_from_name;
const char *iconv_to_name;
MMModemCharset charset;
} CharsetEntry;
static CharsetEntry charset_map[] = {
- { "UTF-8", "UTF-8", "UTF-8//TRANSLIT", MM_MODEM_CHARSET_UTF8 },
- { "UCS2", "UCS-2BE", "UCS-2BE//TRANSLIT", MM_MODEM_CHARSET_UCS2 },
- { "IRA", "ASCII", "ASCII//TRANSLIT", MM_MODEM_CHARSET_IRA },
- { "GSM", NULL, NULL, MM_MODEM_CHARSET_GSM },
- { "8859-1", "ISO8859-1", "ISO8859-1//TRANSLIT", MM_MODEM_CHARSET_8859_1 },
- { "PCCP437", NULL, NULL, MM_MODEM_CHARSET_PCCP437 },
- { "PCDN", NULL, NULL, MM_MODEM_CHARSET_PCDN },
- { "HEX", NULL, NULL, MM_MODEM_CHARSET_HEX },
- { NULL, NULL, NULL, MM_MODEM_CHARSET_UNKNOWN }
+ { "UTF-8", "UTF8", "UTF-8", "UTF-8//TRANSLIT", MM_MODEM_CHARSET_UTF8 },
+ { "UCS2", NULL, "UCS-2BE", "UCS-2BE//TRANSLIT", MM_MODEM_CHARSET_UCS2 },
+ { "IRA", "ASCII", "ASCII", "ASCII//TRANSLIT", MM_MODEM_CHARSET_IRA },
+ { "GSM", NULL, NULL, NULL, MM_MODEM_CHARSET_GSM },
+ { "8859-1", NULL, "ISO8859-1", "ISO8859-1//TRANSLIT", MM_MODEM_CHARSET_8859_1 },
+ { "PCCP437", NULL, NULL, NULL, MM_MODEM_CHARSET_PCCP437 },
+ { "PCDN", NULL, NULL, NULL, MM_MODEM_CHARSET_PCDN },
+ { "HEX", NULL, NULL, NULL, MM_MODEM_CHARSET_HEX },
+ { NULL, NULL, NULL, NULL, MM_MODEM_CHARSET_UNKNOWN }
};
const char *
@@ -66,6 +67,8 @@ mm_modem_charset_from_string (const char *string)
while (iter->gsm_name) {
if (strcasestr (string, iter->gsm_name))
return iter->charset;
+ if (iter->other_name && strcasestr (string, iter->other_name))
+ return iter->charset;
iter++;
}
return MM_MODEM_CHARSET_UNKNOWN;