mirror of
https://github.com/httpie/cli.git
synced 2024-11-25 01:03:27 +01:00
Do not assume UTF-8.
This commit is contained in:
parent
f90ae113e4
commit
0293ba1799
@ -27,10 +27,9 @@ class KeyValueType(object):
|
||||
self.separators = separators
|
||||
|
||||
def __call__(self, string):
|
||||
found = dict(
|
||||
(string.find(sep), sep) for sep in self.separators
|
||||
if string.find(sep) != -1
|
||||
)
|
||||
found = dict((string.find(sep), sep)
|
||||
for sep in self.separators
|
||||
if string.find(sep) != -1)
|
||||
|
||||
if not found:
|
||||
raise argparse.ArgumentTypeError(
|
||||
@ -155,14 +154,15 @@ def main():
|
||||
sys.exit(1)
|
||||
|
||||
# Display the response.
|
||||
encoding = response.encoding or 'ISO-8859-1'
|
||||
original = response.raw._original_response
|
||||
status_line, headers, body = (
|
||||
u'HTTP/{version} {status} {reason}'.format(
|
||||
version='.'.join(str(original.version)),
|
||||
status=original.status, reason=original.reason,
|
||||
),
|
||||
str(original.msg).decode('utf-8'),
|
||||
response.content.decode('utf-8') if response.content else u''
|
||||
str(original.msg).decode(encoding),
|
||||
response.content.decode(encoding) if response.content else u''
|
||||
)
|
||||
|
||||
if args.prettify and sys.stdout.isatty():
|
||||
|
Loading…
Reference in New Issue
Block a user