Browse Source

Improve handling of cp-1252 encoded journals

We now export the journal anyway, replacing any illegal characters with
the replacement character.
pull/152/head
Adam Johnson 6 years ago
parent
commit
bb8554091c
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 8
      korman/exporter/locman.py

8
korman/exporter/locman.py

@ -76,10 +76,12 @@ class LocalizationConverter:
with self._generate_file(dirname="ageresources", filename=file_name) as stream:
stream.write(contents.encode("windows-1252"))
except UnicodeEncodeError:
self._report.error("Translation '{}': Contents contains characters that cannot be used in this version of Plasma",
self._report.warn("Translation '{}': Contents contains characters that cannot be used in this version of Plasma. They will appear as a '?' in game.",
language, indent=2)
return False
else:
# Yes, there are illegal characters... As a stopgap, we will export the file with
# replacement characters ("?") just so it'll work dammit.
stream.write(contents.encode("windows-1252", "replace"))
return True
for journal_name, translations in self._journals.items():

Loading…
Cancel
Save