On 22/02/2005 Radovan Garabik wrote: > > i could write a function to parse the comment and substitute special > > chars with the relevant html code, but maybe this already exists in some > > module? > > just make the page in utf-8, and you'll save you a lot of troubles
ok, how do i do this? simply add a second line with this:? # -*- encoding: utf-8 -*- i use utf8 locales on my machine anyway. > > if not, it'll be hard work, as i've to consider many special chars, and > > at least iso-8859-1* and utf-8 as charmaps. > > if you insist... > a = u'\u010c' > a.encode('ascii', 'xmlcharrefreplace') this fails as the comment contained several chars that couldn't be converted. i've changed my plans, and now will transform the comments to html before saving them in mysql. this way, the comment never contains special chars except they weren't filtered out when safed in mysql. do any filters exist, to transform plain text to html? otherwise i might use third-party products, as text2html. what do you think? bye jonas -- http://mail.python.org/mailman/listinfo/python-list