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

Crash on invalid unicode character #16

Open
adamreid opened this issue Dec 9, 2013 · 1 comment
Open

Crash on invalid unicode character #16

adamreid opened this issue Dec 9, 2013 · 1 comment

Comments

@adamreid
Copy link

adamreid commented Dec 9, 2013

on /r/rust today there's a link entitled "Let's avoid having both foo() and foo_opt()" and it seems the apostrophe in "Let's" is raising a UnicodeEncodeError. Here's a repr of the string in question:
u'\x1b[92m 5 -> \x1b[93m23 \x1b[94mLet\u2019s avoid having both foo() and foo_opt()'

And the traceback.

Traceback (most recent call last):
File "C:\Python27\Scripts\alienfeed-script.py", line 8, in
load_entry_point('AlienFeed==0.3.2', 'console_scripts', 'alienfeed')()
File "C:\Python27\Scripts\alien.py", line 229, in main
subreddit_viewer(subm_gen)
File "C:\Python27\Scripts\alien.py", line 71, in subreddit_viewer
links = submission_getter(generator, verbose=True)
File "C:\Python27\Scripts\alien.py", line 117, in submission_getter
print line
File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\u2019' in position 27: character maps to

@eleweek
Copy link

eleweek commented Sep 5, 2015

setting environment variable PYTHONIOENCODING to utf8 should fix the isssue

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

No branches or pull requests

2 participants