Wireshark mailing list archives

Re: Wireshark-dev Digest, Vol 79, Issue 6


From: Anders Broman <anders.broman () ericsson com>
Date: Wed, 5 Dec 2012 08:54:54 +0000


"SideWinder® Freestyle Pro" is now displayed as "SideWinder\\xc2\\xae Freestyle Pro". I guess this is the kind of 
escaping you were thinking
to Anders, right?
Yes something along those lines.
Regards
Anders
________________________________
From: wireshark-dev-bounces () wireshark org [mailto:wireshark-dev-bounces () wireshark org] On Behalf Of Pascal Quantin
Sent: den 4 december 2012 17:41
To: Developer support list for Wireshark
Cc: cheer_zeng
Subject: Re: [Wireshark-dev] Wireshark-dev Digest, Vol 79, Issue 6


2012/12/4 Anders Broman <anders.broman () ericsson com<mailto:anders.broman () ericsson com>>
Hi,
The correct fix is to change the script make-usb.py in the tools dir to escape non ASCII chars
similarly to make-sminmpec.pl<http://make-sminmpec.pl>
sub escape_non_ascii {
    my $val = unpack 'C', $_[0];
    return sprintf '\0%.3o',$val;
}
and rebuild the file, then submitt a patch with the changes.

Hi,

with the following patch:
Index: tools/make-usb.py
===================================================================
--- tools/make-usb.py    (revision 46346)
+++ tools/make-usb.py    (working copy)
@@ -36,11 +36,11 @@

     if mode == MODE_VENDOR_PRODUCT:
         if re.match("^[0-9a-f]{4}", line):
-            vendors += "    { 0x%s, \"%s\" },\n"%(line[:4], re.sub("\"", "\\\"", re.sub("\?+", "?", 
line[4:].strip().replace("\\", "\\\\"))))
+            vendors += "    { 0x%s, \"%s\" },\n"%(line[:4], re.sub("\"", "\\\"", re.sub("\?+", "?", 
repr(line[4:].strip()).strip("'").replace("\\", "\\\\"))))
             last_vendor = line[:4]
         elif re.match("^\t[0-9a-f]{4}", line):
             line = line.strip()
-            products += "    { 0x%s%s, \"%s\" },\n"%(last_vendor, line[:4], re.sub("\"", "\\\"", re.sub("\?+", "?", 
line[4:].strip().replace("\\", "\\\\"))))
+            products += "    { 0x%s%s, \"%s\" },\n"%(last_vendor, line[:4], re.sub("\"", "\\\"", re.sub("\?+", "?", 
repr(line[4:].strip()).strip("'").replace("\\", "\\\\"))))


 vendors += """    { 0, NULL }\n};

"SideWinder® Freestyle Pro" is now displayed as "SideWinder\\xc2\\xae Freestyle Pro". I guess this is the kind of 
escaping you were thinking to Anders, right?

Note that I'm a newbie in Python so there might be a smarter way to do it. If nobody propose something else, I will 
push it as is and let the Python experts do a follow up if needed.

Pascal.
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: