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

Bill Janssen janssen at parc.com
Thu Jul 31 09:47:12 CEST 2008


> Of course, it's un-Pythonic to enforce pedantry, and we pedants can
> use a string->string encoder correctly.

Sure.  All I was asking was that we not break the existing usage of
the standard library "unquote" by producing a string by *assuming* a
UTF-8 encoded string is what's in those percent-encoded bytes (instead
of, say, ISO 2022-JP).  Let the "new" function produce a string:
"unquote_as_string".

>  > You really want me to remove the encoding= named argument? And hard-code
>  > UTF-8 into these functions?
> 
> A quoting function that accepts bytes *must* have an encoding
> argument.

Huh?  What would it use it for?  The string, if string it is, is
already encoded as octets.  All it needs to do is percent-encode the
reserved octets.  So far as I can see, the "unquote_as_string" is the
function that needs the encoding.  Ah, it's too late, I'll pick this
up tomorrow.

Bill


More information about the Python-Dev mailing list