2017-06-13 8:51 GMT+02:00 Nick Coghlan <ncogh...@gmail.com>: > If we turned the warning off by default, but retained an easy > "on-switch" for the warning to help track places where locale coercion > is triggering unexpectedly (e.g. "PYTHONCOERCECLOCALE=warn"), that > would probably give us the best of both worlds.
Hum, it reminds me when I proposed to add a new "locale" encoding which would be used to explicitly use the locale encoding. My intent was to emit a warning when the locale encoding was used implicitely... The problem is that the locale encoding is basically used *everywhere* in the standard library and *it's fine* :-) Really, using the locale encoding is the right encoding is many use cases. Especially when you work on Windows! Ok, when I proposed the idea, distutils still needed to use UTF-8 explicitly instead of the implicit locale encoding, but you may know how painful it was to change anything in distutils: write a PEP and/or discuss it on distutils-sig, handle backward compatibility, etc. The good news is that these issues are now fixed :-) -- While I'm not opposed to PYTHONCOERCECLOCALE=warn, I'm not sure that *developers* will use it. Usually, developers don't care of Unicode until enough users complain that their application don't work on a specific configuration on a specific platform :-) So I'm not sure that it's useful. We already have many PYTHON* environment variables. I'm not sure that all of them are used. We should be careful when adding new ones ;-) https://docs.python.org/dev/using/cmdline.html#environment-variables It's already possible to implement manually a check in an application to complain if the LC_CTYPE locale "C", no? haypo@selma$ cat > x.py import locale if locale.setlocale(locale.LC_CTYPE, None) == 'C': print("Don't use the C locale") haypo@selma$ LANG= python2 x.py Don't use the C locale haypo@selma$ LANG= python3 x.py Don't use the C locale Victor _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com