Mercurial > cpython-lru_cache-weakref
diff Lib/logging/__init__.py @ 73108:4bb1dc4e2cec 2.7
Closes #13232: Handle multiple encodings in exception logging.
| author | Vinay Sajip <vinay_sajip@yahoo.co.uk> |
|---|---|
| date | Mon, 24 Oct 2011 23:23:02 +0100 |
| parents | 62cf7599e44a |
| children | a7191ec811c6 |
line wrap: on
line diff
--- a/Lib/logging/__init__.py Mon Oct 24 21:29:20 2011 +0300 +++ b/Lib/logging/__init__.py Mon Oct 24 23:23:02 2011 +0100 @@ -478,8 +478,12 @@ 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 #
