From bb8554091c8104b3a9db2b6ed8772a5428bf0dad Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Mon, 1 Apr 2019 16:16:34 -0400 Subject: [PATCH] Improve handling of cp-1252 encoded journals We now export the journal anyway, replacing any illegal characters with the replacement character. --- korman/exporter/locman.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/korman/exporter/locman.py b/korman/exporter/locman.py index 205b7d1..979fe4a 100644 --- a/korman/exporter/locman.py +++ b/korman/exporter/locman.py @@ -76,11 +76,13 @@ 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: - return True + + # 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(): self._report.msg("Copying Journal '{}'", journal_name, indent=1)