> It looks like all other APIs in the Py3k version of
> urllib treat URLs as text.

The URL is text, a string of ASCII characters.  We're just talking
about urllib.quote() and urllib.unquote(), which are there to support
the text-ization of binary values, and the de-text-ization.

> I think that would break too much code, without a good way to
> automatically fix it.

You'd rather break Python?  Somehow I don't think so.

Here's the signature I'm proposing:

  quote() -- takes string or bytes, and produces string.

     If input is a string, looks to optional "encoding" parameter to
     determine character set encoding to use to transform it to byte before
     quoting it.  If "encoding" is not specified, defaults to UTF-8.

  unquote() -- takes string, produces bytes or string

     If optional "encoding" parameter is specified, decodes bytes with
     that encoding and returns string.  Otherwise, returns bytes.

Bill
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to