[issue23993] Use surrogateescape error handler by default in open() if the locale is C

2015-04-18 Thread STINNER Victor
STINNER Victor added the comment: I am -1 on this. (Or may be more). What's the rationale? See the issue #19977. In many cases you get the C locale by mistake. For example, by setting the LANG environment variable to an empty string to run a program in english (whereas LC_MESSAGES is the

[issue23993] Use surrogateescape error handler by default in open() if the locale is C

2015-04-18 Thread R. David Murray
R. David Murray added the comment: I am -1 on this. (Or may be more). What's the rationale? I could see using utf-8 by default if the locale is C, but I don't think we want to encourage going back to a world where people don't pay attention to the encoding of their data. A more productive

[issue23993] Use surrogateescape error handler by default in open() if the locale is C

2015-04-18 Thread STINNER Victor
STINNER Victor added the comment: Updated and better patch: version 2. - revert changes on fileutils.c: it's not useful to check for check_force_ascii(), because this function is more strict than checking of the LC_CTYPE is C - fix _pyio.py: add sys import - complete the documentation - tests

[issue23993] Use surrogateescape error handler by default in open() if the locale is C

2015-04-18 Thread STINNER Victor
New submission from STINNER Victor: As a following of the issue #19977, I propose to use also the surrogateescape error handler in open() by default if the locale is C. Attached issue adds a new sys.getdefaulterrorhandler() function and use it in io.TextIOWrapper (and _pyio.TextIOWrapper).

[issue23993] Use surrogateescape error handler by default in open() if the locale is C

2015-04-18 Thread STINNER Victor
STINNER Victor added the comment: The patch is a work-in-progress, I didn't have time to run unit tests, and the documentation is not completed. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue23993