Skip to content
Myr

Docs: several fixes

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Julen Ruiz Aizpuru · committed by Julen Ruiz Aizpuru · parent 51ebc82 · Browse files · 1 file+8 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+8 added−9 removed

  • other:+8 added−9 removed

1 file+8 added−9 removed

modified:docs/python3.rst+8 added-9 removed
23 unmodified lines
24 connections to machines with different locales.2526 Misconfigured environments can currently cause a wide range of unicode27 problems on Python 3 due to the lack of support for roundtripping28 surrogate escapes. This will not be fixed in Click itself!28 surrogate escapes. This will not be fixed in click itself!2930 For more information see :ref:`python3-surrogates`.3132* Standard input and output on Python 3 is opened in unicode mode by
62 unmodified lines
95Python 3 Surrogate Handling96---------------------------9798Click on Python 3 does all the unicode handling in the standard library99and is subject to it's behavior. On Python 2 click does all the unicode99and is subject to its behavior. On Python 2 click does all the unicode100handling itself which means there are differences in error behavior.101102The most glaring difference is that on Python 2 Unicode will "just work"102The most glaring difference is that on Python 2 unicode will "just work"103but requires extra care on Python 3. The reason for this is that on104Python 3 the encoding detection is done in the interpreter and on Linux105and certain other operating systems it's encoding handling is problematic.105and certain other operating systems its encoding handling is problematic.106107The biggest source of frustration there is that click scripts invoked by108init systems (sysvinit, upstart, systemd, etc.), deployment tools (salt,109puppet) or cronjobs (cron) will refuse to work unless a unicode locale is109puppet) or cron jobs (cron) will refuse to work unless a unicode locale is110exported.111112If click encounters such an environment it will prevent further execution113to force you to force a locale. This is done because click cannot know113to force you to set a locale. This is done because click cannot know114about the state of the system once it's invoked and restore the values115before Python's unicode handling kicked in.116117If you see something like this error on Python 3::
14 unmodified lines
132133 export LC_ALL=de_DE.utf-8134 export LANG=de_DE.utf-8135136If you are on an american machine ``en_EN.utf-8`` is the encoding of137choice. On some newer linux systems you can also try ``C.UTF-8`` as138locale::136If you are on a US machine, ``en_EN.utf-8`` is the encoding of choice. On137some newer linux systems you can also try ``C.UTF-8`` as locale::138139 export LC_ALL=C.UTF-8140 export LANG=C.UTF-8141
10 unmodified lines