diff options
author | Martin Panter <vadmium+py@gmail.com> | 2015-11-24 22:59:28 (GMT) |
---|---|---|
committer | Martin Panter <vadmium+py@gmail.com> | 2015-11-24 22:59:28 (GMT) |
commit | a561c038ab336597652c9074818293ddfc65a25d (patch) | |
tree | 707afa72c0dcd9c19ffa0510b5eaf12acf66283d /Doc/howto | |
parent | 33623b145df4d41f49ab3ae9e781135fb87fd98d (diff) | |
parent | f7e8d07538a1734bdb0438ab53e0a54db456d4d9 (diff) | |
download | cpython-a561c038ab336597652c9074818293ddfc65a25d.zip cpython-a561c038ab336597652c9074818293ddfc65a25d.tar.gz cpython-a561c038ab336597652c9074818293ddfc65a25d.tar.bz2 |
Issue #25576: Merge www-form-urlencoded doc from 3.5
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 e3d7714..9052ed5 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() |