1
0
forked from VimPlug/jedi

finally fixed a unicode problem that existed for a longer time

This commit is contained in:
David Halter
2013-07-18 16:55:19 +02:00
parent 7684135b99
commit 29f89cc75a
3 changed files with 15 additions and 4 deletions

View File

@@ -161,3 +161,13 @@ try:
encoding = 'utf-8'
except AttributeError:
encoding = 'ascii'
def u(string):
"""Cast to unicode DAMMIT!
Written because Python2 repr always implicitly casts to a string, so we
have to cast back to a unicode (and we now that we always deal with valid
unicode, because we check that in the beginning).
"""
if not is_py3k and not isinstance(string, unicode):
return unicode(str(string), 'UTF-8')
return string