Skip to content

Commit

Permalink
Use escape.utf8() instead of .encode('utf-8') so we don't double-encode
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Darnell committed Apr 21, 2010
1 parent c87e84f commit 9f7c9a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion tornado/httpclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import cStringIO
import email.utils
import errno
import escape
import functools
import httplib
import ioloop
Expand Down Expand Up @@ -406,7 +407,7 @@ def _curl_setup_request(curl, request, buffer, headers):

# Handle curl's cryptic options for every individual HTTP method
if request.method in ("POST", "PUT"):
request_buffer = cStringIO.StringIO(request.body.encode('utf-8'))
request_buffer = cStringIO.StringIO(escape.utf8(request.body))
curl.setopt(pycurl.READFUNCTION, request_buffer.read)
if request.method == "POST":
def ioctl(cmd):
Expand Down
2 changes: 1 addition & 1 deletion tornado/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def environ(request):
"SERVER_PROTOCOL": request.version,
"wsgi.version": (1, 0),
"wsgi.url_scheme": request.protocol,
"wsgi.input": cStringIO.StringIO(request.body.encode('utf-8')),
"wsgi.input": cStringIO.StringIO(escape.utf8(request.body)),
"wsgi.errors": sys.stderr,
"wsgi.multithread": False,
"wsgi.multiprocess": True,
Expand Down

0 comments on commit 9f7c9a3

Please sign in to comment.