Fix Window family tree title for non-ASCII chars on Windows (#932)

Fixes #11390

As it says, if Family Tree name contained non-ASCII characters, the titlebar on Windows would display it wrong. Turned out to be reading of a utf8 file without the 'encoding' set. On Windows this results in using the default encoding which is one of the code pages, NOT utf8.
This commit is contained in:
Paul Culley 2019-10-23 18:24:04 -05:00 committed by Sam Manzi
parent 16c8e61944
commit 73d19851ef
2 changed files with 2 additions and 2 deletions

View File

@ -280,7 +280,7 @@ class CLIManager:
# Attempt to figure out the database title
path = os.path.join(filename, "name.txt")
try:
with open(path) as ifile:
with open(path, encoding='utf8') as ifile:
title = ifile.readline().strip()
except:
title = filename

View File

@ -757,7 +757,7 @@ class DbGeneric(DbWriteBase, DbReadBase, UpdateCallback, Callback):
if self._directory:
filepath = os.path.join(self._directory, "name.txt")
try:
with open(filepath, "r") as name_file:
with open(filepath, "r", encoding='utf8') as name_file:
name = name_file.readline().strip()
except (OSError, IOError) as msg:
LOG.error(str(msg))