diff --git a/gramps/gui/widgets/grampletpane.py b/gramps/gui/widgets/grampletpane.py index de91c7a7e..eebbf1de4 100644 --- a/gramps/gui/widgets/grampletpane.py +++ b/gramps/gui/widgets/grampletpane.py @@ -38,6 +38,8 @@ from gi.repository import Gtk from gi.repository import Pango import time import os +import io +from gramps.gen.constfunc import cuni from gramps.gen.const import GRAMPS_LOCALE as glocale _ = glocale.get_translation().gettext import sys @@ -1169,17 +1171,17 @@ class GrampletPane(Gtk.ScrolledWindow): return # something is the matter filename = self.configfile try: - fp = open(filename, "w") + fp = io.open(filename, "w", encoding='utf-8') except IOError: print("Failed writing '%s'; gramplets not saved" % filename) return - fp.write(";; Gramps gramplets file" + NL) - fp.write((";; Automatically created at %s" % - time.strftime("%Y/%m/%d %H:%M:%S")) + NL + NL) - fp.write("[Gramplet View Options]" + NL) - fp.write(("column_count=%d" + NL) % self.column_count) - fp.write(("pane_position=%d" + NL) % self.pane_position) - fp.write(("pane_orientation=%s" + NL) % self.pane_orientation) + fp.write(cuni(";; Gramps gramplets file" + NL)) + fp.write(cuni((";; Automatically created at %s" % + time.strftime("%Y/%m/%d %H:%M:%S")) + NL + NL)) + fp.write(cuni("[Gramplet View Options]" + NL)) + fp.write(cuni(("column_count=%d" + NL) % self.column_count)) + fp.write(cuni(("pane_position=%d" + NL) % self.pane_position)) + fp.write(cuni(("pane_orientation=%s" + NL) % self.pane_orientation)) fp.write(NL) # showing gramplets: for col in range(self.column_count): diff --git a/gramps/plugins/lib/libhtml.py b/gramps/plugins/lib/libhtml.py index c232d1f6b..fe8a333a0 100644 --- a/gramps/plugins/lib/libhtml.py +++ b/gramps/plugins/lib/libhtml.py @@ -36,7 +36,7 @@ from __future__ import print_function import re import locale -from gramps.gen.constfunc import STRTYPE +from gramps.gen.constfunc import STRTYPE, cuni """ HTML operations. @@ -417,14 +417,14 @@ class Html(list): elif self.indent: tabs += indent if self.inline: # if inline, write all list and - method('%s%s' % (tabs, self)) # nested list elements + method(cuni('%s%s' % (tabs, self))) # nested list elements # else: for item in self[:]: # else write one at a time if isinstance(item, Html): # recurse if nested Html class item.write(method=method, indent=indent, tabs=tabs) else: - method('%s%s' % (tabs, item)) # else write the line + method(cuni('%s%s' % (tabs, item))) # else write the line # def addXML(self, version=1.0, encoding="UTF-8", standalone="no"): """