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

Bill Janssen janssen at parc.com
Sun Jul 13 22:36:06 CEST 2008


> Ah there may be some confusion here. We're only dealing with str->str
> transformations (which in Python 3 means Unicode strings). You can't put a
> bytes in or get a bytes out of either of these functions. I suggested a
> "quote_raw" and "unquote_raw" function which would let you do this.

Ah, well, that's a problem.  Clearly the unquote is str->bytes, while
the quote is (bytes OR str)->str.  You can't pass a Unicode string back
as the result of unquote *without* passing in an encoding specifier,
because the character set is application-specific.

Bill


More information about the Python-Dev mailing list