[issue9198] Should repr() print unicode characters outside the BMP?

Ezio Melotti report at bugs.python.org
Fri Jul 9 00:16:02 CEST 2010


Ezio Melotti <ezio.melotti at gmail.com> added the comment:

I suggest to:
  1) keep the current behavior for non-BMP chars (i.e. print them normally);
  2) change isprintable to consider the Zx categories printable (this will affect repr() too);
  3) change displayhook (*NOT* sys.stdout.encoding) to use backslashreplace when the string contains chars that are not encodable with sys.stdout.encoding *.

* note that this will affect only the objects that are converted with repr() in the interpreter e.g. ">>> x = 'foo'; x" and *NOT* ">>> x = 'foo'; print(x)". Since the first behavior exists *only* in the interactive interpreter it won't be inconsistent with normal programs ("x = 'foo'; x" in a program doesn't display anything).

----------

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


More information about the Python-bugs-list mailing list