Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29bdcf0

Browse files
committed
Fixes #1425
1 parent aa088aa commit 29bdcf0

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

thirdparty/multipart/multipartpost.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def http_request(self, request):
7373
request.add_data(data)
7474
return request
7575

76-
def multipart_encode(vars, files, boundary = None, buf = None):
76+
def multipart_encode(vars, files, boundary=None, buf=None):
7777
if boundary is None:
7878
boundary = mimetools.choose_boundary()
7979

@@ -100,7 +100,7 @@ def multipart_encode(vars, files, boundary = None, buf = None):
100100
# buf += 'Content-Length: %s\r\n' % file_size
101101
fd.seek(0)
102102

103-
buf = str(buf)
103+
buf = str(buf) if not isinstance(buf, unicode) else buf.encode("utf8")
104104
buf += '\r\n%s\r\n' % fd.read()
105105

106106
buf += '--%s--\r\n\r\n' % boundary

0 commit comments

Comments
 (0)