Skip to content

Commit

Permalink
Fixed a UnicodeError in Python 2.6.
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbrzt committed Mar 2, 2012
1 parent bb653bf commit 9634dca
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions httpie/httpie.py
Expand Up @@ -108,7 +108,7 @@ def __call__(self, string):

def main(args=None,
stdin=sys.stdin,
stdin_isatty=sys.stdout.isatty(),
stdin_isatty=sys.stdin.isatty(),
stdout=sys.stdout,
stdout_isatty=sys.stdout.isatty()):

Expand Down Expand Up @@ -166,7 +166,7 @@ def main(args=None,
encoding = response.encoding or 'ISO-8859-1'
original = response.raw._original_response
status_line, headers, body = (
u'HTTP/{version} {status} {reason}'.format(
'HTTP/{version} {status} {reason}'.format(
version='.'.join(str(original.version)),
status=original.status, reason=original.reason,
),
Expand All @@ -185,10 +185,11 @@ def main(args=None,
if args.print_headers:
stdout.write(status_line)
stdout.write('\n')
stdout.write(headers)
stdout.write(headers.encode('utf-8'))
stdout.write('\n')
if args.print_body:
stdout.write(body)
stdout.write(body.encode('utf-8'))
stdout.write('\n')

if __name__ == '__main__':
main()

0 comments on commit 9634dca

Please sign in to comment.