summaryrefslogtreecommitdiffstats
path: root/Lib/json
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2019-12-04 09:57:55 (GMT)
committerGitHub <noreply@github.com>2019-12-04 09:57:55 (GMT)
commita75cad440ab50d823af5f06e51dfed3a319f1e8c (patch)
tree9f6192895ece9bfaba668802c82b55c8b855a228 /Lib/json
parentbaf07395eaa77e515ddfa1d3f42785d50b4d2889 (diff)
downloadcpython-a75cad440ab50d823af5f06e51dfed3a319f1e8c.zip
cpython-a75cad440ab50d823af5f06e51dfed3a319f1e8c.tar.gz
cpython-a75cad440ab50d823af5f06e51dfed3a319f1e8c.tar.bz2
bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460)
(cherry picked from commit 808769f3a4cbdc47cf1a5708dd61b1787bb192d4) Co-authored-by: Inada Naoki <songofacandy@gmail.com>
Diffstat (limited to 'Lib/json')
-rw-r--r--Lib/json/tool.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/Lib/json/tool.py b/Lib/json/tool.py
index b3ef992..8db9ea4 100644
--- a/Lib/json/tool.py
+++ b/Lib/json/tool.py
@@ -20,10 +20,12 @@ def main():
description = ('A simple command line interface for json module '
'to validate and pretty-print JSON objects.')
parser = argparse.ArgumentParser(prog=prog, description=description)
- parser.add_argument('infile', nargs='?', type=argparse.FileType(),
+ parser.add_argument('infile', nargs='?',
+ type=argparse.FileType(encoding="utf-8"),
help='a JSON file to be validated or pretty-printed',
default=sys.stdin)
- parser.add_argument('outfile', nargs='?', type=argparse.FileType('w'),
+ parser.add_argument('outfile', nargs='?',
+ type=argparse.FileType('w', encoding="utf-8"),
help='write the output of infile to outfile',
default=sys.stdout)
parser.add_argument('--sort-keys', action='store_true', default=False,