]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Forces JSON files to be written as UTF-8, and disables the ensure ASCII option which...
authorTrenton H <797416+stumpylog@users.noreply.github.com>
Mon, 13 Nov 2023 22:18:21 +0000 (14:18 -0800)
committerGitHub <noreply@github.com>
Mon, 13 Nov 2023 22:18:21 +0000 (14:18 -0800)
src/documents/management/commands/document_exporter.py

index ff200a8f595965e5b17e91b3011c0524caec32db..05c78ea082bf91f0dd0ddb2ed8aeae95d46a4d8c 100644 (file)
@@ -396,20 +396,31 @@ class Command(BaseCommand):
                         notes,
                     ),
                 )
-                manifest_name.write_text(json.dumps(content, indent=2))
+                manifest_name.write_text(
+                    json.dumps(content, indent=2, ensure_ascii=False),
+                    encoding="utf-8",
+                )
                 if manifest_name in self.files_in_export_dir:
                     self.files_in_export_dir.remove(manifest_name)
 
         # 4.1 write manifest to target folder
         manifest_path = (self.target / Path("manifest.json")).resolve()
-        manifest_path.write_text(json.dumps(manifest, indent=2))
+        manifest_path.write_text(
+            json.dumps(manifest, indent=2, ensure_ascii=False),
+            encoding="utf-8",
+        )
         if manifest_path in self.files_in_export_dir:
             self.files_in_export_dir.remove(manifest_path)
 
         # 4.2 write version information to target folder
         version_path = (self.target / Path("version.json")).resolve()
         version_path.write_text(
-            json.dumps({"version": version.__full_version_str__}, indent=2),
+            json.dumps(
+                {"version": version.__full_version_str__},
+                indent=2,
+                ensure_ascii=False,
+            ),
+            encoding="utf-8",
         )
         if version_path in self.files_in_export_dir:
             self.files_in_export_dir.remove(version_path)