[Python-Dev] urllib.quote and unquote - Unicode issues

Bill Janssen janssen at parc.com
Wed Jul 30 21:49:06 CEST 2008

> >  unquote() -- takes string, produces bytes or string
> >
> >     If optional "encoding" parameter is specified, decodes bytes with
> >     that encoding and returns string.  Otherwise, returns bytes.
> The default of returning bytes will break almost all uses. Most code
> will uses the unquoted result as a text string, not as bytes -- e.g. a
> server has to unquote the values it receives from a form (whether POST
> or GET), but almost always the unquoted values are text, e.g.
> someone's name or address, or a draft email message.

I actually do know a lot about the uses of this function...

But:  OK, OK, I yield.  Though I still think this is a bad idea, I'll
shut up if we can also add "unquote_as_bytes" which returns a byte
sequence instead of a string.  I'll just change my code to use that.

> (Aside: I dislike functions that have a different return type based on
> the value of a parameter.)

Fair enough.


More information about the Python-Dev mailing list