[Python-checkins] cpython (2.7): Closes #13232: Handle multiple encodings in exception logging.

Ezio Melotti ezio.melotti at gmail.com
Tue Oct 25 09:52:22 CEST 2011


Hi,

On 25/10/2011 1.26, vinay.sajip wrote:
> http://hg.python.org/cpython/rev/4bb1dc4e2cec
> changeset:   73108:4bb1dc4e2cec
> branch:      2.7
> user:        Vinay Sajip<vinay_sajip at yahoo.co.uk>
> date:        Mon Oct 24 23:23:02 2011 +0100
> summary:
>    Closes #13232: Handle multiple encodings in exception logging.
>
> files:
>    Lib/logging/__init__.py |  8 ++++++--
>    1 files changed, 6 insertions(+), 2 deletions(-)
>
>
> diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py
> --- a/Lib/logging/__init__.py
> +++ b/Lib/logging/__init__.py
> @@ -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

UTF-898?

> +                # for a script. See issue 13232.
> +                s = s + record.exc_text.decode(sys.getfilesystemencoding(),
> +                                               'replace')
>           return s
>
>   #
>

Best Regards,
Ezio Melotti


More information about the Python-checkins mailing list