Unicode characters in SSID

Bug #1547846 reported by Julien
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
wicd
Confirmed
Undecided
Unassigned
wicd (Debian)
New
Unknown

Bug Description

My SSID contains highly unusual unicode characters, and it make wicd-curses to crash with:

   File "/usr/share/wicd/curses/wicd-curses.py", line 175, in check_for_wireless
    ('$A', network).replace
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe0 in position 0: ordinal not in range(128)

The problem is with :

    set_status(_('Connected to $A at $B (IP: $C)').replace
     ('$A', network).replace
                 ('$B', strength).replace
                 ('$C', ip))

Here you're mixing `unicode` and `str` objects, (output of `_` is an unicode string). What's bugging my mind is that `network` come from a "misc.to_unicode" function that actually returns a `str` object and not a `unicode` one as advertised, which is not nice.

If we stop mixing `uncicode` and `str` here and only use `unicode`, we're getting :

         (u'$A', network.decode('utf-8')).replace

it works for me.

'utf-8' is hardcoded here because it's hardcoded also in 'misc.to_unicode', so it may work, but I don't think it's the right way to handle strings in Python, as we're doing (decode().encode().decode()) the first being in `to_unicode` the last in `check_for_wireless` The to_unicode should better return unicode string so we don't need to know (and hardcode) the used encoding.

But I agree that working with unicode in Python 2 is a PITA, maybe 2016 is the time to upgrade to Python 3 ? I may help.

Revision history for this message
Alex Talker (alextalker) wrote :

I have the same error, definitely support python 3 is a good opportunity.

Axel Beckert (xtaran)
Changed in wicd:
status: New → Confirmed
Changed in wicd (Debian):
status: Unknown → New
Revision history for this message
Paul Tötterman (ptman) wrote :

I have the same problem. The suggested fix helps.

Revision history for this message
Rafael Morales Georgi (chocoladisco) wrote :

Minimal working example of this bug is an SSID with the name: 'ä'

to_unicode encodes this as '\xc3\xa4' which then crashes in line 175 as noted by OP.

Revision history for this message
Sebastian Rasmussen (sebras) wrote :

I came across this issue when I attempted to connect to a network named "Jenny的 iPhone".
This led me to this bug report and I verified that the suggested fix resolves the issue.
What do we need to do to get this proposed fix merged to master?

Revision history for this message
Sebastian Rasmussen (sebras) wrote :

I can prepare a patch and attach it here if that helps? If something else is needed let me know and I'll do my very best. :)

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.