Merge pull request #895 from stylight/master

try latin-1 if utf-8 doesn't work, when decoding exception strings
main
Selwin Ong 7 years ago committed by GitHub
commit a4be98dc87

@ -779,7 +779,10 @@ class Worker(object):
def _get_safe_exception_string(exc_strings): def _get_safe_exception_string(exc_strings):
"""Ensure list of exception strings is decoded on Python 2 and joined as one string safely.""" """Ensure list of exception strings is decoded on Python 2 and joined as one string safely."""
if sys.version_info[0] < 3: if sys.version_info[0] < 3:
exc_strings = [exc.decode("utf-8") for exc in exc_strings] try:
exc_strings = [exc.decode("utf-8") for exc in exc_strings]
except ValueError:
exc_strings = [exc.decode("latin-1") for exc in exc_strings]
return ''.join(exc_strings) return ''.join(exc_strings)
def push_exc_handler(self, handler_func): def push_exc_handler(self, handler_func):

Loading…
Cancel
Save