Wireshark-bugs: [Wireshark-bugs] [Bug 5405] Unescaped accent in interface name
Date: Tue, 21 Dec 2010 11:22:28 -0800 (PST)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5405

--- Comment #6 from Stephen Fisher <steve@xxxxxxxxxxxxxxxxxx> 2010-12-21 12:22:27 MST ---
(In reply to comment #4)
> A. I believe that in capture-wpcap.c the pcap_lookupdev() and related code to
> do the unicode to ascii stuff is obsolete and is no longer ever used. (See
> below).

Oh, ok.

>    I'll go through the Wireshark code and see where this might need to be done.
>    (Is the right answer to convert the strings to UTF8 right in
>    get_interface_list() in capture-wpcap.c ? Is there then an issue about
>    needing to convert back to the current locale before printing the strings ?)

I would say yes, convert it to UTF-8 right away.  UTF-8 can represent any
unicode character, but it may take more bytes than a native UTF-16 or UTF-32
would.  However, if the conversion is done from UTF-16 in Winodws to a local
ANSI code page by WinPcap and by us to UTF-8, I'm afraid that information could
be lost in the conversion to and from an ANSI code page.  But if the Windows is
providing a name in the local ANSI code page, that code page should be
sufficient to represent that string properly.  So g_locale_to_utf8() is
probably the best way to handle this.

>    I'm unsure if g_locale_to_utf8() must also be used in *nix systems
>    to handle the case where the character encoding being used by the system is 
>    other than UTF8. I'll do some further research on this (unless someone
>    can provide the answer).

On Unix, the OS only provides the short name for the adapter (such as eth0 or
re1 for example).  The interface's longer description (where this bug is
happening) is only available on Windows AFAIK.

> Info re pcap_findalldevs(0 and pcap_lookupdev() usage.
> 
> 1. In capture-wpcap.c, get_interface_list() calls pcap_findalldevs if the 
>    conditional symbol HAVE_PCAP_FINDALLDEVS is defined.
>    I believe that this will almost always be true since
>    a. that's the way we build and distribute Wireshark;
>    b. pcap_findalldevs was implemented many years ago.
> 
>    so: anyone needing to build without pcap_findalldevs would be using 
>    a very old obsolete version of winpcap.
>
> 2. get_interface_list() calls pcap_lookupdev() only if pcap_findalldevs is not
> available.
>
> The unicode to ASCII stuff happens only if pcap_lookupdev is called.
> 
> I change the code compile the code to use pcap_lookup_dev only if
> pcap_findalldevs isn't available.

Let's remove that code then and require a high enough version of WinPcap.

Thanks!

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.