[docs] [issue25576] Remove “Content-Type: application/x-www-form-urlencoded; charset” advice

Martin Panter report at bugs.python.org
Sat Nov 7 03:43:41 EST 2015


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 at python
components: Documentation
files: urlencoded-charset.patch
keywords: patch
messages: 254263
nosy: docs at 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 <report at bugs.python.org>
<http://bugs.python.org/issue25576>
_______________________________________


More information about the docs mailing list