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] non-ASCII characters

From: Gerald Combs <gerald@xxxxxxxxxxxxx>
Date: Thu, 20 Jan 2011 10:07:32 -0700
On 1/20/11 10:00 AM, Andreas wrote:
> Am 19.01.2011 21:21, schrieb Guy Harris:
>>
>> On Jan 19, 2011, at 12:14 PM, Andreas wrote:
>>
>>> I write a dissector for a protocol that transport measurement values
>>> for pressure and temperature and so on. I would like to display the
>>> values with proto_tree_add_float() with the correct unit. But the °C
>>> symbol as well as µA is not displayed correctly.
>>>
>>> Is there a way display this character set specific characters in
>>> Wireshark? How should I encode these characters that the GTK UI
>>> displays the nice "°C" so that I can avoid "degrees centigrade"?
>>
>> Try encoding them in UTF-8 (*NOT* UTF-16/UCS-2!); that might work.
> Yes it might, but this depends on the current editor I use on different
> workstations. And the fiddling with the editor settings is cumbersome.
>>
>> Of course, getting the Windows C compiler to like it is another matter.
>> You might have to explicitly encode it, e.g. "\302\260C" for "°C".
> I would prefer the escape string "\xC2\xB0" anyway, since it's not only
> a question of the compiler as the version control system incl. diff
> viewer is also part of the tool chain.

You might want to add entries for the units you need to
gtk/utf8_entities.h (and if we're going to use UTF-8 entities in
dissectors we might want to move that file out of the GTK directory).