← Back to team overview

duplicity-team team mailing list archive

Re: Help with unicode branch (for Python3 support)

 

Ken,


On 18/11/17 21:55, Kenneth Loafman wrote:
It seems we are fighting an old Python bug still extant in Python 3.  Namely, sys.getfilesystemencoding() will return ascii if the LC_* variables are not set (cron or other detached processes).  At one time in the early 3 series they defaulted to utf-8 if ascii was returned.  Then, as I understand it, the purists won and ascii is returned now.  [...]

Unless I am mistaken, this situation will be improved in Python 3.7:
https://docs.python.org/3.7/whatsnew/3.7.html
"

An ongoing challenge within the Python 3 series has been determining a sensible default strategy for handling the “7-bit ASCII” text encoding assumption currently implied by the use of the default C locale on non-Windows platforms.

*PEP 538* <https://www.python.org/dev/peps/pep-0538> updates the default interpreter command line interface to automatically coerce that locale to an available UTF-8 based locale as described in the documentation of the new |PYTHONCOERCECLOCALE| <https://docs.python.org/3.7/using/cmdline.html#envvar-PYTHONCOERCECLOCALE> environment variable. Automatically setting |LC_CTYPE| this way means that both the core interpreter and locale-aware C extensions (such as |readline| <https://docs.python.org/3.7/library/readline.html#module-readline>) will assume the use of UTF-8 as the default text encoding, rather than ASCII.

"

Kind regards,

Aaron

References