[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-02-03 Thread STINNER Victor
STINNER Victor added the comment: > Victor, I'm not sure whether you are proposing that > display_hook_ascii.patch is included into Python. IIUC, this patch > breaks PEP3138, so it clearly must be rejected. > > Overall, I fail to see the bug in this report. Python 3.0 works as > designed as show

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Ezio Melotti
Ezio Melotti added the comment: This seems to fix the problem: -- import sys import builtins def hook(message): if message is None: return builtins._ = message try: print(repr(message)) except UnicodeEncodeError: print(ascii(me

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Martin v. Löwis
Martin v. Löwis added the comment: Victor, I'm not sure whether you are proposing that display_hook_ascii.patch is included into Python. IIUC, this patch breaks PEP3138, so it clearly must be rejected. Overall, I fail to see the bug in this report. Python 3.0 works as designed as shown here. -

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' : -- nosy: +giampaolo.rodola ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http:/

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread STINNER Victor
STINNER Victor added the comment: Here is a patch to use ascii() directly in sys_displayhook() (with an unit test!). -- keywords: +patch Added file: http://bugs.python.org/file12894/display_hook_ascii.patch ___ Python tracker

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread STINNER Victor
STINNER Victor added the comment: Oh yeah, original sys.displayhook uses a special hack for the _ global variable: - import sys import builtins def hook(message): if message is None: return builtins._ = message print(ascii(message)) sys.displayhook = hook -

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Ezio Melotti
Ezio Melotti added the comment: This seems to solve the problem, but apparently the interactive "_" doesn't work anymore. ___ Python tracker ___ __

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread STINNER Victor
STINNER Victor added the comment: You change change the display hook with a site.py script (which have to be in sys.path) : - import sys def hook(message): print(ascii(message)) sys.displayhook = hook - Example (run python in an empty environment to get ASCII charset): --

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread STINNER Victor
STINNER Victor added the comment: To be clear, this issue only affects the interpreter. > 2) use ascii(), but it adds extra "" around the output It doesn't ass extra "" if you replace repr() by ascii() in the interpreter code (sys.displayhook)? > The best solution is probably to change the d

[issue5110] Printing Unicode chars from the interpreter in a non-UTF8 terminal (Py3)

2009-01-30 Thread Ezio Melotti
New submission from Ezio Melotti : In Py2.x >>> u'\2620' outputs u'\2620' whereas >>> print u'\2620' raises an error. Instead, in Py3.x, both >>> '\u2620' and >>> print('\u2620') raise an error if the terminal doesn't use an encoding able to display the character (e.g. the windows terminal used