Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[mms-lib] KS_C_5601-1987 is known to g_convert as CP949
  • Loading branch information
monich committed Jan 29, 2015
1 parent f946ef4 commit 32d827a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
5 changes: 3 additions & 2 deletions mms-dump/mms-dump.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2013-2014 Jolla Ltd.
* Copyright (C) 2013-2015 Jolla Ltd.
* Contact: Slava Monich <slava.monich@jolla.com>
*
* 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
Expand Down Expand Up @@ -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},
Expand Down
15 changes: 12 additions & 3 deletions mms-lib/src/mms_codec.c
Expand Up @@ -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" },
Expand Down Expand Up @@ -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;
Expand All @@ -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,
Expand Down
Binary file added mms-lib/test/test_mms_codec/data/m-retrieve_10.conf
Binary file not shown.
4 changes: 3 additions & 1 deletion 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 <slava.monich@jolla.com>
*
* 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
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 32d827a

Please sign in to comment.