aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Vilcans <martin@librador.com>2011-12-10 01:31:29 +0100
committerMartin Vilcans <martin@librador.com>2011-12-10 01:31:29 +0100
commit276ca0b6c5e29a54aa0539a34e0e691b5985454e (patch)
treecda8749b8a8d19cd9e6d3d6cb4eba8679f2c74e1
parent98d3e6a81a4fa49a57a448b06bf6a75d676a547d (diff)
downloadscreenplain-276ca0b6c5e29a54aa0539a34e0e691b5985454e.tar.gz
Use HTML character references for special characters.
E.g. write "&#233"; instead of "é".
-rw-r--r--screenplain/richstring.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/screenplain/richstring.py b/screenplain/richstring.py
index 31dfa53..92b9bdd 100644
--- a/screenplain/richstring.py
+++ b/screenplain/richstring.py
@@ -91,7 +91,7 @@ class Segment(object):
ordered_styles = list(self.styles)
return (
''.join(style.start_html for style in ordered_styles) +
- cgi.escape(self.text) +
+ cgi.escape(self.text).encode('ascii', 'xmlcharrefreplace') +
''.join(style.end_html for style in reversed(ordered_styles))
)