Set encoding to utf-8 when writing files

Since we assume utf-8 in a lot of places.

Contributes to CURA-2692
This commit is contained in:
Arjen Hiemstra 2016-10-24 14:24:49 +02:00
parent be0e48664a
commit bfec96f584
2 changed files with 2 additions and 2 deletions

View file

@ -67,7 +67,7 @@ class RemovableDriveOutputDevice(OutputDevice):
try: try:
Logger.log("d", "Writing to %s", file_name) Logger.log("d", "Writing to %s", file_name)
# Using buffering greatly reduces the write time for many lines of gcode # Using buffering greatly reduces the write time for many lines of gcode
self._stream = open(file_name, "wt", buffering = 1) self._stream = open(file_name, "wt", buffering = 1, encoding = "utf-8")
job = WriteMeshJob(writer, self._stream, node, MeshWriter.OutputMode.TextMode) job = WriteMeshJob(writer, self._stream, node, MeshWriter.OutputMode.TextMode)
job.setFileName(file_name) job.setFileName(file_name)
job.progress.connect(self._onProgress) job.progress.connect(self._onProgress)

View file

@ -111,7 +111,7 @@ class MachineInstance:
user_profile_file = os.path.join(user_storage, urllib.parse.quote_plus(self._name) + "_current_settings.inst.cfg") user_profile_file = os.path.join(user_storage, urllib.parse.quote_plus(self._name) + "_current_settings.inst.cfg")
if not os.path.exists(user_storage): if not os.path.exists(user_storage):
os.makedirs(user_storage) os.makedirs(user_storage)
with open(user_profile_file, "w") as file_handle: with open(user_profile_file, "w", encoding = "utf-8") as file_handle:
user_profile.write(file_handle) user_profile.write(file_handle)
version_upgrade_manager.upgradeExtraFile(user_storage, urllib.parse.quote_plus(self._name), "user") version_upgrade_manager.upgradeExtraFile(user_storage, urllib.parse.quote_plus(self._name), "user")