Patches item #1176578, was opened at 2005-04-04 12:47
Message generated for change (Comment added) made by bcannon
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1176578&group_id=5470
Category: Core (C code)
Group: Python 2.5
>Status: Closed
>Resolution: Rejected
Priority: 5
Submitted By: Brett Cannon (bcannon)
Assigned to: Nobody/Anonymous (nobody)
Summary: Clarify unicode.(en|de)code.() docstrings
Initial Comment:
I was reading the docstrings for unicode.encode() and
unicode.decode() and they were making no sense to me
since I kept expecting ``unicode("hi",
"utf-8").encode("utf-16")`` to return a unicode object,
just with an internal representation of UTF-16. Then I
started playing with them some more and I realized the
methods encoded and decoded into and out of a byte
stream. Then it made sense.
Attached is a patch to mention that they are working
with byte streams. I also capitalized the first words
in all the sentences.
----------------------------------------------------------------------
>Comment By: Brett Cannon (bcannon)
Date: 2005-04-05 15:31
Message:
Logged In: YES
user_id=357491
That figures. OK, closed as rejected.
----------------------------------------------------------------------
Comment By: Hye-Shik Chang (perky)
Date: 2005-04-04 19:56
Message:
Logged In: YES
user_id=55188
That's not true. While the most unicode codecs are doing
such, some doesn't. It's up to each codec's design what it
gets in its unicode.decode and what it returns in its
unicode.encode.
eg:
>>> u'hello, \uAC00!'.encode('breaker')
u'hello, \xea\xb0\x80!'
>>> _.decode('breaker')
u'hello, \uac00!'
class Codec(codecs.Codec):
....def encode(self, data, errors='strict'):
........return
data.encode('utf-8').decode('iso8859-1'),len(data)
....def decode(self, data, errors='strict'):
........return data.encode('iso8859-1').decode('utf-8'),
len(data)
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1176578&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches