pytrade wrote:
> I have a Restr string which I'm converting to HTML
throguh docstring:
> I'm getting the following error from cherrypy:
>
> 30/Mar/2006:05:47:31 INFO Page handler: 'ordinal not
in range(128)'
> Traceback (most recent call last):
> File
>
"/usr/lib/python2.4/site-packages/CherryPy-2.2.0rc1-py
2.4.egg/
cherrypy/_cpwsgi.py",
> line 96, in wsgiApp
> chunk = str(chunk)
> UnicodeEncodeError: 'ascii' codec can't encode
character u'\x92' in
> position 15625: ordinal not in range(128)
>
> When I googled for u'\x92' it turns out to be a LEFT
SINGLE QUOTATION
> MARK. Is there a work around somewhere?
Coerce your output to a string before your return it from
your page
handler. That can be as simple as:
output = output.encode("utf8")
return output
...at the bottom of your page handler.
Another option is to use the encoding filter. But keep in
mind that the
encoding filter only encodes output if the Content-Type
starts with
"text/" (we should probably make that
configurable).
Robert Brewer
System Architect
Amor Ministries
fumanchu amor.org
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-users googlegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribe googlegroups.com
For more options, visit this group at http://
groups.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---
|