[docs] [issue13997] Clearly explain the bare minimum Python 3 users should know about Unicode

Antoine Pitrou report at bugs.python.org
Sun Feb 12 15:53:12 CET 2012


Antoine Pitrou <pitrou at free.fr> added the comment:

> My mental model here is text editors, which let you open any file, do
> their best to display as much as they can and allow you to manipulate
> it without damaging the bits you don't change. I don't see any reason
> why people shouldn't be able to write Python 3 code that way if they
> need to.

Some text editors try to guess the encoding, which is different from
"display invalid characters anyway".
Other text editors like gedit pop up an error when there are invalid
bytes according to the configured encoding.

That said, people *are* able to write Python 3 code the way you said.
They simply have to use the "surrogateescape" error handler.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13997>
_______________________________________


More information about the docs mailing list