diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-07 18:01:28 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-07 19:24:36 +0100 |
commit | 03678df6fdfa32316dbac8b15d10da2ab16a42f7 (patch) | |
tree | c05d0a4a3ef0e03773522a1a56ed8f6ddedda11f /src | |
parent | 00ce1d68744d6c69ea1f5fbb4d49a9d242208a7b (diff) |
gsm: convert SMS text and number from current charset to UTF-8
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-generic-gsm.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c index 098ffa2e..7ea0dfb7 100644 --- a/src/mm-generic-gsm.c +++ b/src/mm-generic-gsm.c @@ -5200,9 +5200,12 @@ get_match_string_unquoted (GMatchInfo *m, guint match_index) static gboolean text_parse_cmgl (MMGenericGsm *self, const char *response, GError **error) { + MMGenericGsmPrivate *priv; GRegex *r; GMatchInfo *match_info = NULL; + priv = MM_GENERIC_GSM_GET_PRIVATE (self); + /* +CMGL: <index>,<stat>,<oa/da>,[alpha],<scts><CR><LF><data><CR><LF> */ r = g_regex_new ("\\+CMGL:\\s*(\\d+)\\s*,\\s*([^,]*),\\s*([^,]*),\\s*([^,]*),\\s*([^\\r\\n]*)\\r\\n(.*)\\r\\n", 0, 0, NULL); g_assert (r); @@ -5235,16 +5238,21 @@ text_parse_cmgl (MMGenericGsm *self, const char *response, GError **error) /* <stat is ignored for now> */ + /* Get and parse number */ number = get_match_string_unquoted (match_info, 3); if (!number) { mm_dbg ("Failed to get message sender number"); goto next; } + number = mm_charset_take_and_convert_to_utf8 (number, + priv->cur_charset); + /* Get and parse timestamp (always expected in ASCII) */ timestamp = get_match_string_unquoted (match_info, 5); - text = g_match_info_fetch (match_info, 6); - /* FIXME: Text is going to be in the character set we've set with +CSCS */ + /* Get and parse text */ + text = mm_charset_take_and_convert_to_utf8 (g_match_info_fetch (match_info, 6), + priv->cur_charset); /* The raw SMS data can only be GSM, UCS2, or unknown (8-bit), so we * need to convert to UCS2 here. |