[New-bugs-announce] [issue10039] python é.py fails with UnicodeEncodeError if PYTHONFSENCODING is used

STINNER Victor report at bugs.python.org
Thu Oct 7 03:25:33 CEST 2010


New submission from STINNER Victor <victor.stinner at haypocalc.com>:

If a program name contains a non-ascii character in its name and/or full path and PYTHONFSENCODING is set to an encoding different than the locale encoding, Python fails to open the program.

Example in the utf-8 locale:

$ PYTHONFSENCODING=ascii ./python é.py
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 0: ordinal not in range(128)

This issue is similar to #9992 and #10014.

Solutions: remove PYTHONFSENCODING environment variable or redecode the filename from the locale encoding to the filesystem encoding.

Attached patch implements the latter.

--

We may also redecode Py_GetProgramName().

----------
components: Interpreter Core, Unicode
files: redecode_filename.patch
keywords: patch
messages: 118089
nosy: haypo
priority: normal
severity: normal
status: open
title: python é.py fails with UnicodeEncodeError if PYTHONFSENCODING is used
versions: Python 3.2
Added file: http://bugs.python.org/file19143/redecode_filename.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10039>
_______________________________________


More information about the New-bugs-announce mailing list