[Python-3000] Questions about email bytes/str (python 3000)

Victor Stinner victor.stinner at haypocalc.com
Wed Aug 15 21:52:38 CEST 2007


On Wednesday 15 August 2007 03:44:54 Bill Janssen wrote:
> > (...) I think that base64MIME.encode() may have to accept strings.
>
> Personally, I think it would avoid more errors if it didn't.

Yeah, how can you guess which charset the user want to use? For most user, 
there is only one charset: latin-1. So I you use UTF-8, he will not 
understand conversion errors.

Another argument: I like bidirectional codec:
   decode(encode(x)) == x
   encode(decode(x)) == x

So if you mix bytes and str, these relations will be wrong.

Victor Stinner aka haypo
http://hachoir.org/


More information about the Python-3000 mailing list