[Python-bugs-list] [ python-Bugs-637094 ] print to unicode stream should __unicode

noreply@sourceforge.net noreply@sourceforge.net
Tue, 12 Nov 2002 07:20:33 -0800


Bugs item #637094, was opened at 2002-11-12 13:24
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=637094&group_id=5470

Category: Unicode
Group: Python 2.2.1
Status: Open
Resolution: None
Priority: 5
Submitted By: Henry S Thompson (hthompson)
Assigned to: M.-A. Lemburg (lemburg)
Summary: print to unicode stream should __unicode

Initial Comment:
To make __unicode__ parallel to __str__ in what seems
like the right way, print >>f,x should check for
__unicode__ if f is a unicode-enabled stream
 See
http://mail.python.org/pipermail/python-list/2002-November/129859.html
for more details

----------------------------------------------------------------------

>Comment By: Martin v. L÷wis (loewis)
Date: 2002-11-12 16:20

Message:
Logged In: YES 
user_id=21627

Henry is talking about the objects returned from
codecs.open, or instantiating the classes returned from
codecs.get_writer.

----------------------------------------------------------------------

Comment By: M.-A. Lemburg (lemburg)
Date: 2002-11-12 15:58

Message:
Logged In: YES 
user_id=38388

I'm not sure I understand: what is a "unicode stream".

All streams in Python are considered byte streams and
(currently) have no encoding attached. Changing that
would require a lot of work, some of which is under way.

Still, the best way to deal with this is to first encode Unicode
to a string using a known stream encoding and then sending
off the 8-bit data from the encoding process to the stream.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=637094&group_id=5470