# HG changeset patch # User Matt Mackall # Date 2014-06-12 19:40:45 # Node ID 2d47d81c79fb3ddcd82c600710f1bd41c9f806a8 # Parent 4c62478be2ea302b8f15fbb3644236f45a9ceec4 i18n: explicitly decode paragraphs This was triggering an exception when the default encoding was disabled. diff --git a/mercurial/i18n.py b/mercurial/i18n.py --- a/mercurial/i18n.py +++ b/mercurial/i18n.py @@ -36,7 +36,11 @@ def gettext(message): if message is None: return message - paragraphs = message.split('\n\n') + if type(message) is unicode: + # goofy unicode docstrings in test + paragraphs = message.split(u'\n\n') + else: + paragraphs = [p.decode("ascii") for p in message.split('\n\n')] # Be careful not to translate the empty string -- it holds the # meta data of the .po file. u = u'\n\n'.join([p and t.ugettext(p) or '' for p in paragraphs])