From 03678df6fdfa32316dbac8b15d10da2ab16a42f7 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 7 Feb 2012 18:01:28 +0100 Subject: gsm: convert SMS text and number from current charset to UTF-8 --- src/mm-generic-gsm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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: ,,,[alpha], */ 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) /* */ + /* 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. -- cgit v1.2.3-70-g09d2