diff -r 424d1e37c3d2 Lib/urllib/request.py --- a/Lib/urllib/request.py Tue Feb 01 02:12:30 2011 +0800 +++ b/Lib/urllib/request.py Tue Feb 01 03:30:17 2011 +0800 @@ -1054,7 +1054,10 @@ 'application/x-www-form-urlencoded') if not request.has_header('Content-length'): try: - mv = memoryview(data) + if isinstance(data, str): + mv = memoryview(bytes(data, 'ascii')) + else: + mv = memoryview(data) except TypeError: if isinstance(data, collections.Iterable): raise ValueError("Content-Length should be specified \