diff --git a/gramps/cli/grampscli.py b/gramps/cli/grampscli.py index efc50b7b7..fb7e2454d 100644 --- a/gramps/cli/grampscli.py +++ b/gramps/cli/grampscli.py @@ -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 diff --git a/gramps/gen/db/generic.py b/gramps/gen/db/generic.py index 8607c37c7..ba445c9d8 100644 --- a/gramps/gen/db/generic.py +++ b/gramps/gen/db/generic.py @@ -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))