mirror of
https://github.com/wakatime/sublime-wakatime.git
synced 2023-08-10 21:13:02 +03:00
prevent crashing when logging object unable to be converted to unicode
This commit is contained in:
parent
a69c50f470
commit
c574234927
@ -47,6 +47,8 @@ if is_py2:
|
||||
def u(text):
|
||||
if text is None:
|
||||
return None
|
||||
if isinstance(text, unicode):
|
||||
return text
|
||||
try:
|
||||
return text.decode('utf-8')
|
||||
except:
|
||||
@ -58,8 +60,11 @@ if is_py2:
|
||||
except:
|
||||
try:
|
||||
return text.decode('utf-8', 'replace')
|
||||
except AttributeError:
|
||||
return unicode(str(text))
|
||||
except:
|
||||
try:
|
||||
return unicode(str(text))
|
||||
except:
|
||||
return unicode('')
|
||||
|
||||
elif is_py3:
|
||||
def u(text):
|
||||
|
Loading…
Reference in New Issue
Block a user