docs: Output JSON files with UTF-8 encoding
authorSebastian Dröge <sebastian@centricular.com>
Sun, 10 May 2020 08:35:53 +0000 (11:35 +0300)
committerSebastian Dröge <sebastian@centricular.com>
Sun, 10 May 2020 08:35:53 +0000 (11:35 +0300)
Otherwise non-ASCII characters are encoded as \uXXXX.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/474>

docs/gst-plugins-doc-cache-generator.py

index 11d7d52..596fcad 100755 (executable)
@@ -122,9 +122,9 @@ if __name__ == "__main__":
 
     modified = dict_recursive_update(cache, plugins)
 
-    with open(output_filename, 'w', newline='\n') as f:
-        json.dump(cache, f, indent=4, sort_keys=True)
+    with open(output_filename, 'w', newline='\n', encoding='utf8') as f:
+        json.dump(cache, f, indent=4, sort_keys=True, ensure_ascii=False)
 
     if modified:
-        with open(cache_filename, 'w', newline='\n') as f:
-            json.dump(cache, f, indent=4, sort_keys=True)
+        with open(cache_filename, 'w', newline='\n', encoding='utf8') as f:
+            json.dump(cache, f, indent=4, sort_keys=True, ensure_ascii=False)