Issue1130

classification
Title: printing Unicode doesn't work
Type: Severity: normal
Components: Core Versions: Deferred
Milestone:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: leosoto, pekka.klarck, pjenvey
Priority: low Keywords:

Created on 2008-09-13.22:32:05 by leosoto, last changed 2009-05-29.01:04:59 by pjenvey.

Files
File name Uploaded Description Edit Remove
stdoutwrapper_str.diff pjenvey, 2008-09-14.00:03:14
Messages
msg3544 (view) Author: Leonardo Soto (leosoto) Date: 2008-09-13.22:32:05
Jython 2.5a3+ (trunk:exportado, sep 13 2008, 18:30:17) 
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_06
Type "help", "copyright", "credits" or "license" for more information.
>>> print u"fóó"
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode characters in position
1-4: ordinal not in range(128)

[The expected behaviour is to print out the string, as CPython does]
msg3550 (view) Author: Leonardo Soto (leosoto) Date: 2008-09-13.23:11:53
A potential fix is on http://codereview.appspot.com/5653
msg3558 (view) Author: Philip Jenvey (pjenvey) Date: 2008-09-14.00:03:14
StdoutWrapper actually shouldn't be calling __str__ on the obj -- it 
should just pass the original object to the stdout file for writing. 
Attached is a patch that fixes this, which is more correct.

However this bug is still a problem, because we lack a 
sys.stdout.encoding value
msg3603 (view) Author: Pekka Klärck (pekka.klarck) Date: 2008-09-16.14:33:13
Could this be related to the following Unicode issues already present in
2.2?

#1032 - 2.2.1: "%s" % u"\xA7" -> UnicodeError
http://bugs.jython.org/issue1032


#1802339 - [221rc1] Problem printing unicode when stdout intercepted
http://bugs.jython.org/issue1802339
msg3605 (view) Author: Leonardo Soto (leosoto) Date: 2008-09-16.17:21:27
#1032 is a somewhat related, but different problem. Already fixed in
trunk, by the way.
msg4744 (view) Author: Philip Jenvey (pjenvey) Date: 2009-05-29.01:04:58
This works now that StdoutWrapper now works as I described and we have a 
usually accurate encoding value on sys.stdout/stderr
History
Date User Action Args
2009-05-29 01:04:59pjenveysetstatus: open -> closed
resolution: fixed
messages: + msg4744
2009-03-14 14:19:07fwierzbickisetpriority: low
2008-09-16 17:21:27leosotosetmessages: + msg3605
versions: + Deferred
2008-09-16 14:33:13pekka.klarcksetnosy: + pekka.klarck
messages: + msg3603
2008-09-14 00:03:16pjenveysetfiles: + stdoutwrapper_str.diff
nosy: + pjenvey
messages: + msg3558
2008-09-13 23:11:53leosotosetmessages: + msg3550
2008-09-13 22:32:05leosotocreate