diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-11-24 22:33:18 +0000 |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-11-24 22:33:18 +0000 |
commit | 79c718f384b0852342aa4398011f0f234f77aa48 (patch) | |
tree | 9494dcf9eb6e0ac00ea7823450932d0691e16792 /Doc/howto | |
parent | f65db9582d6c6c0a551b3ea7bc1f857af6233783 (diff) | |
download | cpython-79c718f384b0852342aa4398011f0f234f77aa48.tar.gz |
Issue #25576: Remove application/x-www-form-urlencoded charset advice
No charset parameter is standardized for this Content-Type value. Also
clarify that urlencode() outputs ASCII.
Diffstat (limited to 'Doc/howto')
-rw-r--r-- | Doc/howto/urllib2.rst | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/howto/urllib2.rst b/Doc/howto/urllib2.rst index e3d77142f4..9052ed59b0 100644 --- a/Doc/howto/urllib2.rst +++ b/Doc/howto/urllib2.rst @@ -115,7 +115,7 @@ library. :: 'language' : 'Python' } data = urllib.parse.urlencode(values) - data = data.encode('utf-8') # data should be bytes + data = data.encode('ascii') # data should be bytes req = urllib.request.Request(url, data) with urllib.request.urlopen(req) as response: the_page = response.read() @@ -180,8 +180,8 @@ Explorer [#]_. :: 'language' : 'Python' } headers = { 'User-Agent' : user_agent } - data = urllib.parse.urlencode(values) - data = data.encode('utf-8') + data = urllib.parse.urlencode(values) + data = data.encode('ascii') req = urllib.request.Request(url, data, headers) with urllib.request.urlopen(req) as response: the_page = response.read() |