[New-bugs-announce] [issue2630] repr() should not escape non-ASCII characters
report at bugs.python.org
Mon Apr 14 11:54:24 CEST 2008
New submission from atsuo ishimoto <ishimoto at users.sourceforge.net>:
In py3k, repr() escapes non-ASCII characters in Unicode to \uXXXX as
Python 2. This is unpleasant feature if you are working with non-latin
characters. This issue was once discussed by Hye-Shik Chang, but was
rejected. Here's a new challenge for Python 3 to fix issue.
In this patch, repr() converts special ascii characters such as "\t",
"\r", "\n", but doesn't convert non-ASCII characters to \uXXXX form.
Non-ASCII characters are converted by TextIOWrapper on printing. I set
'errors' attribute of sys.stdout and sys.stderr to 'backslashreplace', so
un-printable characters are converted to '\uXXXX' if your console
cannot print such characters.
This patch breaks five regr tests on my environment.
I'll fix these tests if this patch is acceptable.
title: repr() should not escape non-ASCII characters
type: feature request
versions: Python 3.0
Added file: http://bugs.python.org/file10028/diff.txt
Tracker <report at bugs.python.org>
More information about the New-bugs-announce