harmy / boar

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

tounicode fails if no preferred locale is set #85

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. get a mac
2. clone boar
3. /boar mkrepo ~/Documents/boar

common.py (line 580+)
on my machine locale.getpreferredlocale() returns an empty string
 so, s.decode() fails

I have made a patch to use the LC_CTYPE instead but i don't knox if it's the 
expected behavior

Original issue reported on code.google.com by renaud.g...@gmail.com on 16 Nov 2012 at 10:06

Attachments:

GoogleCodeExporter commented 9 years ago
... and if locale is not set, call setlocale

Original comment by renaud.g...@gmail.com on 16 Nov 2012 at 10:17

Attachments:

GoogleCodeExporter commented 9 years ago
Good catch. I'm not familiar with mac as you might have guessed, but your 
analysis and solution looks good at a quick glance. What version of boar are 
you experiencing this problem on? Could you also please post a full stack trace 
of the exception?

Original comment by ekb...@gmail.com on 16 Nov 2012 at 10:43

GoogleCodeExporter commented 9 years ago
I'm using the latest tip of the hg repo (changeset ea53816029f1)

Traceback (most recent call last):
  File "./boar", line 1331, in <module>
    sys.argv = map(tounicode, sys.argv)
  File "/Users/renaud/projects/vendors/boar/common.py", line 584, in tounicode
    s = s.decode(locale.getpreferredencoding())
LookupError: unknown encoding: 

(while executing "./boar mkrepo pia")

Original comment by renaud.g...@gmail.com on 16 Nov 2012 at 2:23