summaryrefslogtreecommitdiff
path: root/epan/dissectors/packet-xml.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-12-19 09:19:33 +0000
committerGuy Harris <guy@alum.mit.edu>2013-12-19 09:19:33 +0000
commit317b82898664af0f0fe71c513995bb137d0a3c57 (patch)
tree37b1f0304675d62189eebd6faaa8d8383eba893e /epan/dissectors/packet-xml.c
parent4a346b71882c782cf070e382a4bf718150b192d8 (diff)
downloadwireshark-317b82898664af0f0fe71c513995bb137d0a3c57.tar.gz
Use proto_tree_add_item() or tvb_get_string_enc() instead of
tvb_get_unicode_string(). If there's an indication that the encoding is UCS-2, use that, otherwise use UTF-16. (For example, "BMP" stands for "Basic Multilingual Plane", which is the part of Unicode that can be encoded in 16 bits, hence UCS-2.) In the description of the "Use Heuristics for UDP" preference for the XML dissector, note that it's not just trying to recognize XML in UCS-2, it's trying to recognize XML in *big-endian* UCS-2. svn path=/trunk/; revision=54245
Diffstat (limited to 'epan/dissectors/packet-xml.c')
-rw-r--r--epan/dissectors/packet-xml.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/epan/dissectors/packet-xml.c b/epan/dissectors/packet-xml.c
index cf857d947d..9a28a1f727 100644
--- a/epan/dissectors/packet-xml.c
+++ b/epan/dissectors/packet-xml.c
@@ -238,7 +238,8 @@ static gboolean dissect_xml_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *
dissect_xml(tvb, pinfo, tree);
return TRUE;
} else if (pref_heuristic_unicode) {
- const guint8 *data_str = tvb_get_unicode_string(NULL, tvb, 0, tvb_length(tvb), ENC_LITTLE_ENDIAN);
+ /* XXX - UCS-2, or UTF-16? */
+ const guint8 *data_str = tvb_get_string_enc(NULL, tvb, 0, tvb_length(tvb), ENC_UCS_2|ENC_LITTLE_ENDIAN);
tvbuff_t *unicode_tvb = tvb_new_child_real_data(tvb, data_str, tvb_length(tvb)/2, tvb_length(tvb)/2);
tvb_set_free_cb(unicode_tvb, g_free);
if (tvbparse_peek(tvbparse_init(unicode_tvb, 0, -1, NULL, want_ignore), want_heur)) {
@@ -1476,8 +1477,9 @@ proto_register_xml(void)
prefs_register_bool_preference(xml_module, "heuristic_udp", "Use Heuristics for UDP",
"Try to recognize XML for unknown UDP ports",
&pref_heuristic_udp);
+ /* XXX - UCS-2, or UTF-16? */
prefs_register_bool_preference(xml_module, "heuristic_unicode", "Use Unicode in heuristics",
- "Try to recognize XML encoded in Unicode (UCS-2)",
+ "Try to recognize XML encoded in Unicode (UCS-2BE)",
&pref_heuristic_unicode);
g_array_free(ett_arr, TRUE);