community-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1867565 - /comdev/reporter.apache.org/trunk/scripts/prettify.py
Date Thu, 26 Sep 2019 08:24:40 GMT
Author: sebb
Date: Thu Sep 26 08:24:39 2019
New Revision: 1867565

URL: http://svn.apache.org/viewvc?rev=1867565&view=rev
Log:
Ensure output retains UTF-8 characters

Modified:
    comdev/reporter.apache.org/trunk/scripts/prettify.py

Modified: comdev/reporter.apache.org/trunk/scripts/prettify.py
URL: http://svn.apache.org/viewvc/comdev/reporter.apache.org/trunk/scripts/prettify.py?rev=1867565&r1=1867564&r2=1867565&view=diff
==============================================================================
--- comdev/reporter.apache.org/trunk/scripts/prettify.py (original)
+++ comdev/reporter.apache.org/trunk/scripts/prettify.py Thu Sep 26 08:24:39 2019
@@ -29,8 +29,8 @@ for arg in args.file:
             input = json.loads(f.read().decode('UTF-8', errors='replace'))
         out = arg if args.clobber else arg + ".out"
         print("Writing " + out)
-        with open(out, "w") as f:
-            json.dump(input, f, indent=args.indent, sort_keys=sort_keys)
+        with open(out, "w", encoding='utf-8') as f:
+            json.dump(input, f, indent=args.indent, sort_keys=sort_keys, ensure_ascii=False)
      # we catch exception so can continue to process other files
     except Exception as ex:
         print(ex)
@@ -41,4 +41,4 @@ if len(args.file) == 0:
         input = json.loads(sys.stdin.buffer.read().decode('UTF-8', errors='replace'))
     except AttributeError:
         input = json.loads(sys.stdin.read().decode('UTF-8', errors='replace'))
-    json.dump(input, sys.stdout, indent=args.indent, sort_keys=sort_keys)
+    json.dump(input, sys.stdout, indent=args.indent, sort_keys=sort_keys, ensure_ascii=False)



Mime
View raw message