Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRemco Burema <r.burema@ultimaker.com>2019-08-08 16:47:05 +0300
committerRemco Burema <r.burema@ultimaker.com>2019-08-08 16:47:05 +0300
commit0b27119001a26cdab60c836d611cd4ffa81937d3 (patch)
treef6f33f93e206a6f34286e3a1369513eabe3bf2db /scripts
parent2d4fd5649d154cc0196ede93af2a2f8049aeedb0 (diff)
Fix encoding/decoding issues (Windows) for i18n import script.
part of CURA-6663
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lionbridge_import.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/lionbridge_import.py b/scripts/lionbridge_import.py
index 07c5d5b66a..0c2c132216 100644
--- a/scripts/lionbridge_import.py
+++ b/scripts/lionbridge_import.py
@@ -2,6 +2,7 @@
# Cura is released under the terms of the LGPLv3 or higher.
import argparse #To get the source directory from command line arguments.
+import io # To fix encoding issues in Windows
import os #To find files from the source.
import os.path #To find files from the source and the destination path.
@@ -34,12 +35,12 @@ def lionbridge_import(source: str) -> None:
else:
raise Exception("Unknown file: " + source_file + "... Is this Cura or Uranium?")
- with open(os.path.join(directory, file_pot)) as f:
+ with io.open(os.path.join(directory, file_pot), encoding = "utf8") as f:
source_str = f.read()
- with open(destination_file) as f:
+ with io.open(destination_file, encoding = "utf8") as f:
destination_str = f.read()
result = merge(source_str, destination_str)
- with open(destination_file, "w") as f:
+ with io.open(destination_file, "w", encoding = "utf8") as f:
f.write(result)
## Gets the destination path to copy the translations for Cura to.