diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-sms-part.c | 9 | ||||
-rw-r--r-- | src/tests/test-sms-part.c | 11 |
2 files changed, 18 insertions, 2 deletions
diff --git a/src/mm-sms-part.c b/src/mm-sms-part.c index 5fd46ff2..954d45bd 100644 --- a/src/mm-sms-part.c +++ b/src/mm-sms-part.c @@ -248,12 +248,16 @@ sms_decode_text (const guint8 *text, int len, SmsEncoding encoding, int bit_offs guint32 unpacked_len; if (encoding == MM_SMS_ENCODING_GSM7) { + mm_dbg ("Converting SMS part text from GSM7 to UTF8..."); unpacked = gsm_unpack ((const guint8 *) text, len, bit_offset, &unpacked_len); utf8 = (char *) mm_charset_gsm_unpacked_to_utf8 (unpacked, unpacked_len); + mm_dbg (" Got UTF-8 text: '%s'", utf8); g_free (unpacked); - } else if (encoding == MM_SMS_ENCODING_UCS2) + } else if (encoding == MM_SMS_ENCODING_UCS2) { + mm_dbg ("Converting SMS part text from UCS-2BE to UTF8..."); utf8 = g_convert ((char *) text, len, "UTF8", "UCS-2BE", NULL, NULL, NULL); - else { + mm_dbg (" Got UTF-8 text: '%s'", utf8); + } else { g_warn_if_reached (); utf8 = g_strdup (""); } @@ -575,6 +579,7 @@ mm_sms_part_new_from_binary_pdu (guint index, /* 8-bit encoding is usually binary data, and we have no idea what * actual encoding the data is in so we can't convert it. */ + mm_dbg ("Skipping SMS part text: 8-bit or Unknown encoding"); mm_sms_part_set_text (sms_part, ""); } else { /* Otherwise if it's 7-bit or UCS2 we can decode it */ diff --git a/src/tests/test-sms-part.c b/src/tests/test-sms-part.c index 8ed02d55..e1f43f7d 100644 --- a/src/tests/test-sms-part.c +++ b/src/tests/test-sms-part.c @@ -20,6 +20,7 @@ #include "mm-sms-part.h" #include "mm-utils.h" +#include "mm-log.h" /* If defined will print debugging traces */ #ifdef TEST_SMS_PART_ENABLE_TRACE @@ -668,6 +669,16 @@ test_create_pdu_gsm_no_validity (void) 1); /* expected_msgstart */ } +void +_mm_log (const char *loc, + const char *func, + guint32 level, + const char *fmt, + ...) +{ + /* Dummy log function */ +} + int main (int argc, char **argv) { g_type_init (); |