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:
		| @@ -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 | ||||
|   | ||||
| @@ -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)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user