From 785913fff3fa8a6cd7c2f0725183be1349fae360 Mon Sep 17 00:00:00 2001 From: Anders Broman Date: Tue, 8 Jan 2008 05:29:38 +0000 Subject: From Shmulik Bezalel: Add support for ucs2 on ussd string. (Changing the font from Lucida console to Arial dissplaed all chars correctly). svn path=/trunk/; revision=24030 --- asn1/gsmmap/gsmmap.cnf | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'asn1') diff --git a/asn1/gsmmap/gsmmap.cnf b/asn1/gsmmap/gsmmap.cnf index d589451541..6dd7ead968 100644 --- a/asn1/gsmmap/gsmmap.cnf +++ b/asn1/gsmmap/gsmmap.cnf @@ -358,6 +358,9 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; tvbuff_t *parameter_tvb; int length; guint8 out_len; + gchar *utf8_text = NULL; + GIConv cd; + GError *l_conv_error = NULL; /* XXX - The maximum item label length is 240. Does this really need to be 1024? * use ep_alloc ? */ @@ -367,9 +370,10 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; if (!parameter_tvb) return offset; - if(sms_encoding==SMS_ENCODING_7BIT){ - length = tvb_length_remaining(parameter_tvb,0); - + length = tvb_length_remaining(parameter_tvb,0); + switch(sms_encoding){ + case SMS_ENCODING_7BIT: + case SMS_ENCODING_7BIT_LANG: out_len = gsm_sms_char_7bit_unpack(0, length, sizeof(bigbuf), tvb_get_ptr(parameter_tvb, 0, length), bigbuf); @@ -377,6 +381,28 @@ actx->pinfo->p2p_dir = P2P_DIR_RECV; gsm_sms_char_ascii_decode(bigbuf, bigbuf, out_len); bigbuf[1023] = '\0'; proto_tree_add_text(tree, parameter_tvb, 0, length, "USSD String: %%s", bigbuf); + break; + case SMS_ENCODING_8BIT: + proto_tree_add_text(tree, parameter_tvb , 0, length, "USSD String: %%s",tvb_get_ptr(parameter_tvb, 0, length)); + break; + case SMS_ENCODING_UCS2: + case SMS_ENCODING_UCS2_LANG: + if ((cd = g_iconv_open("UTF-8","UCS-2BE")) != (GIConv) -1) + { + utf8_text = g_convert_with_iconv(parameter_tvb->real_data , length , cd , NULL , NULL , &l_conv_error); + if(!l_conv_error) + proto_tree_add_text(tree , parameter_tvb , 0 , length, "USSD String: %%s", utf8_text); + else + proto_tree_add_text(tree , parameter_tvb , 0 , length, "USSD String: g_convert_with_iconv FAILED"); + if(utf8_text) + g_free(utf8_text); + g_iconv_close(cd); + } + else + proto_tree_add_text(tree , parameter_tvb , 0 , length, "USSD String: g_iconv_open FAILED contact wireshark"); + break; + default: + break; } #.FN_FTR ForwardingOptions -- cgit v1.2.3