Re: [Cheetahtemplate-discuss] Htmltext and latin-1 characters

Ian Bicking <[email protected]>
Newsgroups gmane.comp.web.quixote.user,gmane.comp.python.cheetah
Message-ID <[email protected]>
You might find the WebHelpers html_quote function useful:
http://pylonshq.com/project/pylonshq/browser/WebHelpers/trunk/webhelpers/util.py

Specifically asciification:

if not isinstance(s, basestring):
     if hasattr(s, '__unicode__'):
         s = unicode(s)
     else:
         s = str(s)
s = cgi.escape(s, True)
if isinstance(s, unicode):
     s = s.encode('ascii', 'xmlcharrefreplace')


-- 
Ian Bicking  /  [email protected]  /  http://blog.ianbicking.org
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.