diff --git a/mms-dump/mms-dump.c b/mms-dump/mms-dump.c index 0a5ed91..a15d68e 100644 --- a/mms-dump/mms-dump.c +++ b/mms-dump/mms-dump.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2013-2014 Jolla Ltd. + * Copyright (C) 2013-2015 Jolla Ltd. + * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -516,7 +517,7 @@ mms_value_decode_encoded_text( { "ISO-8859-10", 13}, { "Shift_JIS", 17}, { "EUC-JP", 18}, - { "KS_C_5601-1987", 36}, + { "CP949", 36}, { "ISO-2022-KR", 37}, { "EUC-KR", 38}, { "ISO-2022-JP", 39}, diff --git a/mms-lib/src/mms_codec.c b/mms-lib/src/mms_codec.c index 4a3bf14..3ad9c05 100644 --- a/mms-lib/src/mms_codec.c +++ b/mms-lib/src/mms_codec.c @@ -126,7 +126,7 @@ static const struct { { 13, "ISO-8859-10" }, { 17, "Shift_JIS" }, { 18, "EUC-JP" }, - { 36, "KS_C_5601-1987" }, + { 36, "CP949" }, { 37, "ISO-2022-KR" }, { 38, "EUC-KR" }, { 39, "ISO-2022-JP" }, @@ -517,6 +517,8 @@ static char *decode_encoded_string_with_mib_enum(const unsigned char *p, const char *to_codeset = "UTF-8"; gsize bytes_read; gsize bytes_written; + char* converted; + GError *error = NULL; if (wsp_decode_integer(p, l, &mib_enum, &consumed) == FALSE) return NULL; @@ -533,9 +535,16 @@ static char *decode_encoded_string_with_mib_enum(const unsigned char *p, if (from_codeset == NULL) return NULL; - return g_convert((const char *) p + consumed, l - consumed, + converted = g_convert((const char *) p + consumed, l - consumed, to_codeset, from_codeset, - &bytes_read, &bytes_written, NULL); + &bytes_read, &bytes_written, &error); + + if (!converted) { + MMS_ERR("%s", MMS_ERRMSG(error)); + g_error_free(error); + } + + return converted; } static char* decode_encoded_text(enum wsp_value_type t, diff --git a/mms-lib/test/test_mms_codec/data/m-retrieve_10.conf b/mms-lib/test/test_mms_codec/data/m-retrieve_10.conf new file mode 100644 index 0000000..bf40142 Binary files /dev/null and b/mms-lib/test/test_mms_codec/data/m-retrieve_10.conf differ diff --git a/mms-lib/test/test_mms_codec/test_mms_codec.c b/mms-lib/test/test_mms_codec/test_mms_codec.c index 47546c2..8e83e1b 100644 --- a/mms-lib/test/test_mms_codec/test_mms_codec.c +++ b/mms-lib/test/test_mms_codec/test_mms_codec.c @@ -1,5 +1,6 @@ /* - * Copyright (C) 2013-2014 Jolla Ltd. + * Copyright (C) 2013-2015 Jolla Ltd. + * Contact: Slava Monich * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -67,6 +68,7 @@ int main(int argc, char* argv[]) "m-retrieve_7.conf", "m-retrieve_8.conf", "m-retrieve_9.conf", + "m-retrieve_10.conf", "m-notifyresp.ind", "m-read-rec.ind", "m-send_1.req",