Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unicode error #3

Open
GoogleCodeExporter opened this issue Mar 22, 2015 · 7 comments
Open

unicode error #3

GoogleCodeExporter opened this issue Mar 22, 2015 · 7 comments

Comments

@GoogleCodeExporter
Copy link

Works fine for a few seconds, then bombs out on my netbook:

Traceback (most recent call last):
  File "pyview.py", line 52, in <module>
    print "%s %s" %(apbssid, lbss[bssid])
UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffd' in position 
18: ordinal not in range(128)

Original issue reported on code.google.com by [email protected] on 10 Nov 2012 at 3:22

@GoogleCodeExporter
Copy link
Author

made the offending string unicode by appending .encode("iso-8859-1") to it.  
New error:

Traceback (most recent call last):
  File "pyview.py", line 52, in <module>
    print ("%s %s" %(apbssid, lbss[bssid])).encode("iso-8859-1")
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 18-19: 
ordinal not in range(256)

Original comment by [email protected] on 10 Nov 2012 at 3:25

@GoogleCodeExporter
Copy link
Author

Obviously this stems from malformed packets (probably due to jumping channels 
in the middle of packet reception -- we need cutoff avoidance?)

Quick fix is to make the print statement .encode("utf-16")

You'll see some weird symbols but it'll at least output without crashing the 
terminal.

Original comment by [email protected] on 10 Nov 2012 at 3:29

@GoogleCodeExporter
Copy link
Author

utf-8 works best.

Original comment by [email protected] on 10 Nov 2012 at 3:31

@GoogleCodeExporter
Copy link
Author

[deleted comment]

2 similar comments
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

implemented a semaphore system that is a waste of time since there are no 
collisions apparently.

I'll just properly encode the strings - simple is best.

Original comment by [email protected] on 10 Nov 2012 at 6:46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant