New submission from Martin Panter:

I understand using a “charset” parameter with “Content-Type: 
application/x-www-form-urlencoded” is not standardized. Since Issue 11082, the 
documentation advises to use it, but I propose to remove this advice.

HTML 5 mentions setting a _charset_ parameter, and mentions decoding with a 
default of UTF-8 (not Latin-1!), but does not mention any Content-Type 
parameters.

There seems to be confusion about what encoding it actually represents. 
According to <https://bugzilla.mozilla.org/show_bug.cgi?id=7533>, Mozilla 
briefly set this “charset” parameter a long time ago, but it would have 
corresponded to the urlencode(encoding=...) argument. The Python documentation 
currently suggests calling data.encode("utf-8"), which is misleading, because 
the urlencode() output is already guaranteed to be ASCII text. Any non-ASCII 
characters and bytes will already be character-encoded and percent-encoded by 
urlencode(). So I also propose to change the examples to data.encode("ascii").

----------
assignee: docs@python
components: Documentation
files: urlencoded-charset.patch
keywords: patch
messages: 254263
nosy: docs@python, martin.panter, orsenthil
priority: normal
severity: normal
stage: patch review
status: open
title: Remove “Content-Type: application/x-www-form-urlencoded; charset” advice
versions: Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file40970/urlencoded-charset.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25576>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to