Extension to simpledoc.html_escape to support also characters like @ÄÜö€
stephanki opened this issue · comments
Currently only the characters <>& are escaped. Using cgi.escape() and encode works for much more characters:
see yattag.simpledoc.html_escape()
# original code
#return s.replace("&", "&").replace("<", "<").replace(">", ">")
import cgi
return cgi.escape(s).encode('ascii','xmlcharrefreplace').decode('ascii')
I don't think that's an issue.
Needing to write characters as html entities usually just means you declared the wrong character set.
Pretty much everybody uses an utf-8 character set these days, with XML or HTML. In this context, the only characters that need to be escaped are '&' and '<'. You don't need to encode any other character using html entities.