alarmz / boar

Automatically exported from code.google.com/p/boar
0 stars 0 forks source link

UnicodeEncodeError: 'ascii' codec can't #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Import a directory with option -v -n

What is the expected output? What do you see instead?
Boar should dry run through and print out all necessary information. Instead it 
spitted out : 

UnicodeEncodeError: 'ascii' codec can't encode character u'\xa1' 
in position 0: ordinal not in range(128)

and stop

What platform are you using? (Windows XP, Windows 7, Linux, ...)
Windows 7

What version of Python are you using?
2.6
What version of boar are you using? (Mercurial change id or daily build
date)
Boar daily 13 Feb-2011

Please provide any additional information below.
This is an issue with sys.stdout.print cannot print out non-ascii character. A 
common fix is to use Django's smart_str. 
Reference : 
http://www.saltycrane.com/blog/2008/11/python-unicodeencodeerror-ascii-codec-can
t-encode-character/

Original issue reported on code.google.com by uts...@gmail.com on 24 Feb 2011 at 4:30

GoogleCodeExporter commented 9 years ago
This problem pops up when python detects an output locale that cannot handle 
some of the characters in filenames. I have only encountered this issue when 
redirecting the output, but it will also happen if your locale indicates ascii. 
A workaround would be to change the default locale for python in windows (I do 
not know how to do that however). 

But boar should of course be able to handle all kinds of encodings and locales 
gracefully. 

Original comment by ekb...@gmail.com on 25 Feb 2011 at 1:33

GoogleCodeExporter commented 9 years ago
Fixed in changeset 288:24951d848d46. Please confirm that it works.

Original comment by ekb...@gmail.com on 25 Feb 2011 at 9:08

GoogleCodeExporter commented 9 years ago
Confirmed fixed.

Original comment by uts...@gmail.com on 2 Mar 2011 at 5:38

GoogleCodeExporter commented 9 years ago

Original comment by ekb...@gmail.com on 2 Mar 2011 at 11:52