collective / mr.bob

Mister Bob (the builder) is filesystem template renderer
http://mrbob.readthedocs.org/en/latest/
Other
69 stars 30 forks source link

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128) #79

Open jdinunzio opened 8 years ago

jdinunzio commented 8 years ago

When I execute mr.bob, it fails because my name is José

Traceback (most recent call last):
  File "/usr/local/bin/mrbob", line 9, in <module>
    load_entry_point('mr.bob==0.1.2', 'console_scripts', 'mrbob')()
  File "/Library/Python/2.7/site-packages/mrbob/cli.py", line 172, in main
    c.ask_questions()
  File "/Library/Python/2.7/site-packages/mrbob/configurator.py", line 231, in ask_questions
    self.variables[question.name] = question.ask(self)
  File "/Library/Python/2.7/site-packages/mrbob/configurator.py", line 303, in ask
    question = six.u("--> %s [%s]: ") % (self.question, self.default)

The code:

                # mrbob/configurator,py:301
                # prepare question
                if self.default:
                    question = six.u("--> %s [%s]: ") % (self.question, self.default)
                else:
                    question = six.u("--> %s: ") % self.question

The question is "Author's name" and the default is "José Dinuncio", which can't be converted to unicode, since six.u requires ASCII.

simon-previdente commented 8 years ago

I encountered the same problem. To solve it, I changed my git config :

$ git config --global user.name
Simon Prévidente

$ git config --global user.name "Simon PREVIDENTE" --replace-all

$ git config --global user.name
Simon PREVIDENTE
jdinunzio commented 8 years ago

Yes, another option is to use ~/.mrbob

[variables]
author.name = Jose Dinuncio

but ideally, mr.bob should accept unicode.

The proble is that six.u() requires ASCII in python 2.7. Maybe it could assume that the default values come in utf8?

anuyens commented 6 years ago

Thank's a lot, I've the same problem.... MrBob don't like André but Andre he like :-)