Skip to content

Commit

Permalink
i18n: guard against non-unicode results from gettext
Browse files Browse the repository at this point in the history
Some configurations may end up with non-unicode results from the gettext
library.  Decode our inputs to ensure that they're always unicode.

Closes #969
Reported-by: Guo Yunhe <guoyunhebrave@gmail.com>
Signed-off-by: David Aguilar <davvid@gmail.com>
  • Loading branch information
davvid committed Jul 21, 2019
1 parent e1bd48e commit 5cbaad0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions cola/i18n.py
Expand Up @@ -19,6 +19,7 @@ def gettext(s):
# Python 3 compat
_translation.ugettext = _translation.gettext
txt = _translation.gettext(s)
txt = core.decode(txt)
if txt[-6:-4] == '@@': # handle @@verb / @@noun
txt = txt[:-6]
return txt
Expand Down
3 changes: 3 additions & 0 deletions share/doc/git-cola/relnotes.rst
Expand Up @@ -18,6 +18,9 @@ Clone the git-cola repo to get the latest development version:

Fixes
-----
* Non-unicode results from the `gettext` library are more robustly handled.
(`#969 <https://github.com/git-cola/git-cola/issues/969>`_)

* Launching `git cola` from within a directory that has since been deleted
would previously result in a traceback, and is now robustly handled.
(`#961 <https://github.com/git-cola/git-cola/issues/961>`_)
Expand Down

0 comments on commit 5cbaad0

Please sign in to comment.