summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-10-24 22:23:02 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-10-24 22:23:02 (GMT)
commit9a11b296b27d4cd11f86c3dde3d0c3683fb14690 (patch)
tree87e3ba1084490ce241fff9d4e80a5ebfae2b6e71
parent99e93d2ddeb195800e0d2b447bad0ee477a5d135 (diff)
downloadcpython-9a11b296b27d4cd11f86c3dde3d0c3683fb14690.zip
cpython-9a11b296b27d4cd11f86c3dde3d0c3683fb14690.tar.gz
cpython-9a11b296b27d4cd11f86c3dde3d0c3683fb14690.tar.bz2
Closes #13232: Handle multiple encodings in exception logging.
-rw-r--r--Lib/logging/__init__.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
index aaad898..c18d5ba 100644
--- a/Lib/logging/__init__.py
+++ b/Lib/logging/__init__.py
@@ -478,8 +478,12 @@ class Formatter(object):
except UnicodeError:
# Sometimes filenames have non-ASCII chars, which can lead
# to errors when s is Unicode and record.exc_text is str
- # See issue 8924
- s = s + record.exc_text.decode(sys.getfilesystemencoding())
+ # See issue 8924.
+ # We also use replace for when there are multiple
+ # encodings, e.g. UTF-898 for the filesystem and latin-1
+ # for a script. See issue 13232.
+ s = s + record.exc_text.decode(sys.getfilesystemencoding(),
+ 'replace')
return s
#