Open all files with utf-8 encoding

- will not be used for binary read/writes (rb,wb)!
- prevents a bug where units with special characters in the unit name can not be tracked anymore as there will be a name mismatch due to wrong encoding
This commit is contained in:
RndName
2021-08-12 23:32:09 +02:00
parent c80d0e5378
commit b5b0d82a1a
9 changed files with 10 additions and 8 deletions

View File

@@ -228,7 +228,7 @@ class QWaitingForMissionResultWindow(QDialog):
)
print(file)
try:
with open(file[0], "r") as json_file:
with open(file[0], "r", encoding="utf-8") as json_file:
json_data = json.load(json_file)
json_data["mission_ended"] = True
debriefing = Debriefing(json_data, self.game, self.unit_map)

View File

@@ -43,7 +43,7 @@ class Campaign:
@classmethod
def from_file(cls, path: Path) -> Campaign:
with path.open() as campaign_file:
with path.open(encoding="utf-8") as campaign_file:
if path.suffix == ".yaml":
data = yaml.safe_load(campaign_file)
else: