A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-March/133226.html below:

[Python-Dev] Python 3.5 now uses surrogateescape for the POSIX locale

[Python-Dev] Python 3.5 now uses surrogateescape for the POSIX locale [Python-Dev] Python 3.5 now uses surrogateescape for the POSIX localeVictor Stinner victor.stinner at gmail.com
Tue Mar 18 02:54:43 CET 2014
Hi,

I modified Python 3.5 to use the "surrogateescape" error handler (PEP
383) for stdin and stdout when the LC_CTYPE locale is POSIX ("C"
locale):
http://bugs.python.org/issue19977

New behaviour:
---
$ mkdir z
$ touch z/abcé
$ LC_CTYPE=C ./python -c 'import os; print(os.listdir("z")[0])'
abcé
---

Old behaviour, before the change (test with Python 3.3):
---
$ LC_CTYPE=C python3 -c 'import os; print(os.listdir("z")[0])'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position
3-4: ordinal not in range(128)
---

The POSIX locale is common because it is used by default when no other
locale is set. It's common that programs started by a crontab on UNIX
and daemons are using this locale.

Victor
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4