ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

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

From: "cheer_zeng"<cheer_zeng@xxxxxxx>
Date: Wed, 5 Dec 2012 01:02:33 +0800
What luck!
 
I follow the cmd tips ,just "Save the file in Unicode format to prevent
data loss "  ,(save" usb.c to unicode using UltraEdit file->convert->AsII to Unicode )then ,repeat the three teps:
 
nmake -f Makefile.nmake setup
nmake -f Makefile.nmake distclean
nmake -f Makefile.nmake all
 
and it can work now.
 
I cam so happy...
 
Thank you all so much.
2012-12-05

cheer_zeng

发件人:Pascal Quantin
发送时间:2012-12-05 00:41
主题:Re: [Wireshark-dev] Wireshark-dev Digest, Vol 79, Issue 6
收件人:"Developer support list for Wireshark"<wireshark-dev@xxxxxxxxxxxxx>
抄送:"cheer_zeng"<cheer_zeng@xxxxxxx>
 

2012/12/4 Anders Broman <anders.broman@xxxxxxxxxxxx>
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
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.