mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 16:48:31 +02:00
Merge pull request #346 from ametheus/patch-2
Fix improper charset handling in PY2 path of u(x)
This commit is contained in:
commit
4f23169d4e
1 changed files with 1 additions and 6 deletions
|
@ -67,12 +67,7 @@ def set_keychain(journal_name, password):
|
|||
|
||||
def u(s):
|
||||
"""Mock unicode function for python 2 and 3 compatibility."""
|
||||
if PY3:
|
||||
return str(s)
|
||||
elif isinstance(s, basestring) and type(s) is not unicode:
|
||||
return unicode(s.encode('string-escape'), "unicode_escape")
|
||||
return unicode(s)
|
||||
|
||||
return s if PY3 or type(s) is unicode else s.decode("utf-8")
|
||||
|
||||
def py2encode(s):
|
||||
"""Encodes to UTF-8 in Python 2 but not r."""
|
||||
|
|
Loading…
Add table
Reference in a new issue