aboutsummaryrefslogtreecommitdiffstats
path: root/epan
diff options
context:
space:
mode:
authorVasil Velichckov <vvvelichkov@gmail.com>2017-06-17 04:16:02 +0300
committerGuy Harris <guy@alum.mit.edu>2017-06-17 02:36:17 +0000
commit85e2a54703da8adee8bf7aefc67f4851ee3b3f1d (patch)
treef12163912aad125c2a36e11e3af2aa01f49a4254 /epan
parent454b5aeddfc7256ebd898e904bc8cb3883305699 (diff)
gsm_sms: decode UCS2 as UTF-16
Some phones (Android and iOS smartphones) encode emoji characters as UTF-16 big endian and although the UTF-16 is not specified in the 3GPP 23.038 (GSM 03.38) it seems to be widely supported Bug: 13808 Change-Id: Ic4a600e42fb4b471223aaef1a661bd002835b519 Reviewed-on: https://code.wireshark.org/review/22181 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r--epan/dissectors/packet-gsm_sms.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/epan/dissectors/packet-gsm_sms.c b/epan/dissectors/packet-gsm_sms.c
index 83ba3aa598..238bbd7b95 100644
--- a/epan/dissectors/packet-gsm_sms.c
+++ b/epan/dissectors/packet-gsm_sms.c
@@ -782,7 +782,7 @@ dis_field_pid(tvbuff_t *tvb, proto_tree *tree, guint32 offset, guint8 oct)
static const value_string dcs_character_set_vals[] = {
{0x00, "GSM 7 bit default alphabet"},
{0x01, "8 bit data"},
- {0x02, "UCS2 (16 bit)"},
+ {0x02, "UCS2 (16 bit)/UTF-16"},
{0x03, "Reserved"},
{0, NULL }
};
@@ -2207,9 +2207,13 @@ dis_field_ud(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset
if (!(reassembled && pinfo->num == reassembled_in))
{
- /* Show unreassembled SMS */
+ /* Show unreassembled SMS
+ * Decode as ENC_UTF_16 instead of UCS2 because Android and iOS smartphones
+ * encode emoji characters as UTF-16 big endian and although the UTF-16
+ * is not specified in the 3GPP 23.038 (GSM 03.38) it seems to be widely supported
+ */
proto_tree_add_item(subtree, hf_gsm_sms_text, sm_tvb,
- 0, rep_len, ENC_UCS_2|ENC_BIG_ENDIAN);
+ 0, rep_len, ENC_UTF_16|ENC_BIG_ENDIAN);
} else {
/* Show reassembled SMS. We show each fragment separately
* so that the text doesn't get truncated when we add it to
@@ -2227,9 +2231,13 @@ dis_field_ud(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 offset
&frag_params_key);
if (p_frag_params) {
+ /* Decode as ENC_UTF_16 instead of UCS2 because Android and iOS smartphones
+ * encode emoji characters as UTF-16 big endian and although the UTF-16
+ * is not specified in the 3GPP 23.038 (GSM 03.38) it seems to be widely supported
+ */
proto_tree_add_item(subtree, hf_gsm_sms_text, sm_tvb, total_sms_len,
(p_frag_params->udl > SMS_MAX_MESSAGE_SIZE ? SMS_MAX_MESSAGE_SIZE : p_frag_params->udl),
- ENC_UCS_2|ENC_BIG_ENDIAN);
+ ENC_UTF_16|ENC_BIG_ENDIAN);
total_sms_len += p_frag_params->length;
}