UnicodeDecodeError: 'ascii' codec can't decode byte... errors on OS X

Matt Mackall mpm at selenic.com
Tue Aug 20 23:10:19 UTC 2013


On Wed, 2013-08-21 at 00:04 +0200, Martin Geisler wrote:
> Matthias Pigulla <mp at webfactory.de> writes:
> 
> Hi Matthias,
> 
> > I often get the above mentioned errors from hg, even on simple command
> > typos like shown in http://bpaste.net/show/mHiB5oIho06bGqAyrJ76/.
> 
> The traceback:
> 
>   mp at silverbook:~$ hg something
>   hg: unbekannter Befehl 'something'
>   Traceback (most recent call last):
>     File "/opt/local/bin/hg", line 38, in <module>
>       mercurial.dispatch.run()
>     File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 28, in run
>       sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
>     File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 69, in dispatch
>       ret = _runcatch(req)
>     File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/dispatch.py", line 162, in _runcatch
>       commands.help_(ui, 'shortlist')
>     File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/commands.py", line 3407, in help_
>       text = help.help_(ui, name, **opts)
>     File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/help.py", line 502, in help_
>       rst.extend(helplist())
>     File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/help.py", line 329, in helplist
>       doc = gettext(doc)
>     File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mercurial/i18n.py", line 42, in gettext
>       u = u'\n\n'.join([p and t.ugettext(p) or '' for p in paragraphs])
>     File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/gettext.py", line 404, in ugettext
>       return unicode(message)
>   UnicodeDecodeError: 'ascii' codec can't decode byte 0xc4 in position 60: ordinal not in range(128)
> 
> The above error occurs if we try to translate an already translated
> string, that is run a string through Gettext twice. The second time
> triggers the error since the input string will (most likely) contain
> non-ASCII characters ("Ä" in this case) which cannot be decoded with
> Python's default encoding (ASCII).
> 
> I don't see how that error would happen here. The code in question is
> 
>             doc = e[0].__doc__
>             if doc and 'DEPRECATED' in doc and not ui.verbose:
>                 continue
>             doc = gettext(doc)
> 
> where e[0] is one of the functions in mercurial.commands. As far as I
> know, we've never had an "Ä" in the docstring for a command function.
> 
> Which Mercurial version are you running? I tried to reproduce it with
> Mercurial 2.{2,3,4,5,6,7} but the German translation worked fine with
> those versions.

Looks like:

http://www.bz.selenic.com/show_bug.cgi?id=3482

(unreleased)

-- 
Mathematics is the supreme nostalgia of our time.





More information about the Mercurial mailing list