[Cheetahtemplate-discuss] How to specify encoding in Cheetah templates
Brought to you by:
rtyler,
tavis_rudd
From: deelan <de...@in...> - 2003-09-23 11:21:11
|
hi there, i'm playing around with PyGoogle, a wrapper around Google search API. everything was going well, until webware gave me this traceback: File "C:\Python\Lib\site-packages\Cheetah\Filters.py", line 106, in filter return str(val) UnicodeEncodeError: 'ascii' codec can't encode character '\uc1' in position 0: ordinal not in range(128) the template is very simple, this is the relevant part: <p>Search done in $_.data.meta.searchTime msec</p> <dl> #for $result in $_.data.results <dt>$result.title</dt> <dd>$result.summary</dd> #end for </dl> basically the "title" and "summary" fields of the search result contains characters (encoded in UTF-8?) outside ascii range and cheetah chokes on them. is there a simple way to tell cheetah to use a particular encoding while displaying string? or must be managed bny python and should i put some code on the servlet? TIA, deelan |