M.-A. Lemburg writes:
.encode() should translate Unicode to a string. Since the named char thing is probably only useful on input, I'd say: don't do anything, except maybe return input.encode('unicode-escape').
Wait... then you can't stack it on top of unicode-escape, because it would already be Unicode escaped.
4) What do you with the error \N{...... no closing right bracket. I'd suggest to take the upper bound of all Unicode name lengths as limit.
Seems like a hack.
Note that .decode() must only return the decoded data. The "bytes read" integer was removed in order to make the Codec APIs compatible with the standard file object APIs.
Huh? Why does Misc/unicode.txt describe decode() as "Decodes the object input and returns a tuple (output object, length consumed)"? Or are you talking about a different .decode() method? -- A.M. Kuchling http://starship.python.net/crew/amk/ "Ruby's dead?" "Yes." "Ah me. That's the trouble with mortals. They do that. Not to worry, eh?" -- Dream and Pharamond, in SANDMAN #46: "Brief Lives:6"