wicd 1.5.1 can't connect the unicode ESSID again

Bug #269664 reported by Rory Ye
6
Affects Status Importance Assigned to Milestone
wicd
Fix Released
High
David Paleino

Bug Description

My ESSID contains Chinese character . and can't connect this wireless.

refreshing...
ESSID : “苹果”的“网络”
======= “苹果”的“网络” ========

Traceback (most recent call last):
  File "/usr/lib64/python2.5/site-packages/wicd/gui.py", line 1979, in connect
    self.update_statusbar()
  File "/usr/lib64/python2.5/site-packages/wicd/gui.py", line 1624, in update_statusbar
    self.set_status(wireless.GetCurrentNetwork(iwconfig) + ': ' +
  File "/usr/lib64/python2.5/site-packages/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib64/python2.5/site-packages/dbus/connection.py", line 607, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.UnicodeEncodeError: Traceback (most recent call last):
  File "/usr/lib64/python2.5/site-packages/dbus/service.py", line 696, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/wicd/wicd-daemon.py", line 796, in GetCurrentNetwork
    current_network = str(self.wifi.GetCurrentNetwork(iwconfig))
  File "/usr/lib64/python2.5/site-packages/wicd/networking.py", line 453, in GetCurrentNetwork
    return self.wiface.GetCurrentNetwork(iwconfig)
  File "/usr/lib64/python2.5/site-packages/wicd/wnettools.py", line 1161, in GetCurrentNetwork
    network = misc.to_unicode(network)
  File "/usr/lib64/python2.5/site-packages/wicd/misc.py", line 290, in to_unicode
    ret = x.decode(encoding, 'replace').encode('utf-8')
  File "/usr/lib64/python2.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

thanks

Related branches

Revision history for this message
Dan O'Reilly (oreilldf) wrote :

Open up a terminal and run the command "python". This will open up the python interactive prompt. Run the following commands in the prompt:
import locale
print locale.getpreferredencoding()

and paste the results here. Thanks.

Dan O'Reilly (oreilldf)
Changed in wicd:
assignee: nobody → oreilldf
importance: Undecided → Medium
status: New → In Progress
Revision history for this message
Rory Ye (rory-cn) wrote :

Hi Dan,
this is my results.

rory@gentoo ~ $ python
Python 2.5.2 (r252:60911, Sep 12 2008, 19:41:30)
[GCC 4.2.4 (Gentoo 4.2.4 p1.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> print locale.getpreferredencoding()
UTF-8
>>>
rory@gentoo ~ $ wicd-client
Loading...
Attempting to connect tray to daemon...
Success.
Done.
refreshing...
wired profiles found
ESSID : “苹果”的“网络”
======= “苹果”的“网络” ========
Traceback (most recent call last):
  File "/usr/lib64/python2.5/site-packages/wicd/gui.py", line 1624, in update_statusbar
    self.set_status(wireless.GetCurrentNetwork(iwconfig) + ': ' +
  File "/usr/lib64/python2.5/site-packages/dbus/proxies.py", line 140, in __call__
    **keywords)
  File "/usr/lib64/python2.5/site-packages/dbus/connection.py", line 607, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Python.UnicodeEncodeError: Traceback (most recent call last):
  File "/usr/lib64/python2.5/site-packages/dbus/service.py", line 696, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/wicd/wicd-daemon.py", line 796, in GetCurrentNetwork
    current_network = str(self.wifi.GetCurrentNetwork(iwconfig))
  File "/usr/lib64/python2.5/site-packages/wicd/networking.py", line 453, in GetCurrentNetwork
    return self.wiface.GetCurrentNetwork(iwconfig)
  File "/usr/lib64/python2.5/site-packages/wicd/wnettools.py", line 1161, in GetCurrentNetwork
    network = misc.to_unicode(network)
  File "/usr/lib64/python2.5/site-packages/wicd/misc.py", line 290, in to_unicode
    ret = x.decode(encoding, 'replace').encode('utf-8')
  File "/usr/lib64/python2.5/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-8: ordinal not in range(128)

Revision history for this message
Dan O'Reilly (oreilldf) wrote :

Hmm, I'm having trouble reproducing this:

dan@ubuntop:~$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> test = "苹果”的“网络"
>>> test.decode(locale.getpreferredencoding(), 'replace').encode('utf-8')
'\xe8\x8b\xb9\xe6\x9e\x9c\xe2\x80\x9d\xe7\x9a\x84\xe2\x80\x9c\xe7\xbd\x91\xe7\xbb\x9c'
>>> print test.decode(locale.getpreferredencoding(), 'replace').encode('utf-8')
苹果”的“网络
>>>

Does running the commands above fail for you?

Revision history for this message
Rory Ye (rory-cn) wrote :

Hi,Dan

rory@gentoo ~ $ python
Python 2.5.2 (r252:60911, Sep 12 2008, 19:41:30)
[GCC 4.2.4 (Gentoo 4.2.4 p1.0)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> test = "“苹果”的“网络”"
>>> test.decode(locale.getpreferredencoding(), 'replace').encode('utf-8')
'\xe2\x80\x9c\xe8\x8b\xb9\xe6\x9e\x9c\xe2\x80\x9d\xe7\x9a\x84\xe2\x80\x9c\xe7\xbd\x91\xe7\xbb\x9c\xe2\x80\x9d'
>>> print test.decode(locale.getpreferredencoding(), 'replace').encode('utf-8')
“苹果”的“网络”
>>>

that run well.

Revision history for this message
Dan O'Reilly (oreilldf) wrote :

If you go to the line in the /usr/lib64/python2.5/site-packages/wicd/misc.py specified here:
 File "/usr/lib64/python2.5/site-packages/wicd/misc.py", line 290, in to_unicode
    ret = x.decode(encoding, 'replace').encode('utf-8')

and make it look like this:
    ret= x.decode("utf-8", 'replace').encode('utf-8')

do you still see this error?

You'll have to restart the wicd daemon and gui before the change gets picked up.

Changed in wicd:
status: In Progress → Incomplete
Revision history for this message
Rory Ye (rory-cn) wrote :

Hi Dan,
Thinks for your reply.

I change the code .and the error disapper, But I can't connect my network

When I click the connect the status bar show Generating PSK.... then no response.

Then I click the cancel button. still Generation PSK... can't stop it.

My network is WPA2 Encryption

Revision history for this message
Rory Ye (rory-cn) wrote :
Revision history for this message
Rory Ye (rory-cn) wrote :
Revision history for this message
Robby Workman (rworkman) wrote :

Rory,
There have been quite a few unicode-related changes since Sept 2008; can you advise whether this is still a problem with 1.5.9?

Revision history for this message
Rory Ye (rory-cn) wrote :

Hi,Robby

And I don't have the unicode ESSID environment now.and the new wicd worked fine for any of my essid.maybe I should give a unicode ESSID to try again.

Dan O'Reilly (oreilldf)
Changed in wicd:
assignee: oreilldf → nobody
importance: Medium → Undecided
Revision history for this message
Robby Workman (rworkman) wrote :

Closing as "Fix Released" based on lack of reproduction on current releases. Please file a new report if this rears its head again.

Changed in wicd:
status: Incomplete → Fix Released
Changed in wicd:
assignee: nobody → Marinescu Marius (mss-marius)
status: Fix Released → Incomplete
status: Incomplete → New
David Paleino (dpaleino)
Changed in wicd:
assignee: Marinescu Marius (mss-marius) → David Paleino (dpaleino)
milestone: none → 1.7.1
importance: Undecided → High
status: New → Fix Committed
David Paleino (dpaleino)
Changed in wicd:
status: Fix Committed → Fix Released
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.