aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2012-02-07 18:01:28 +0100
committerDan Williams <dcbw@redhat.com>2012-02-07 14:02:14 -0600
commit5127fd0ee1aef86c98227ac4df1c4e5ca9afefe6 (patch)
tree97bc55f3476e22d9ff8a40e52316630ef6384c31
parentf01f92b4572f864f79d2acbc1486ed602ded5035 (diff)
gsm: convert SMS text and number from current charset to UTF-8
-rw-r--r--src/mm-generic-gsm.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/mm-generic-gsm.c b/src/mm-generic-gsm.c
index 4b701c75..3d65d34f 100644
--- a/src/mm-generic-gsm.c
+++ b/src/mm-generic-gsm.c
@@ -5090,9 +5090,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);
@@ -5125,16 +5128,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.