diff --git a/screenplain/richstring.py b/screenplain/richstring.py index e24db1a..2d75f85 100644 --- a/screenplain/richstring.py +++ b/screenplain/richstring.py @@ -116,7 +116,7 @@ def to_html(self): re.sub( ' +', # at least two spaces lambda m: ' ' * (len(m.group(0)) - 1) + ' ', - cgi.escape(self.text).encode('ascii', 'xmlcharrefreplace'), + cgi.escape(self.text).encode('utf-8', 'xmlcharrefreplace').decode('utf-8'), ) + ''.join(style.end_html for style in reversed(ordered_styles)) )