[Zope] Odd Unicode error
Dieter Maurer
dieter at handshake.de
Tue Jul 27 16:14:26 EDT 2004
Michael Ekstrand wrote at 2004-7-26 16:16 -0500:
>The application has an Edit page which uses HTMLArea to provide a
>WYSIWYG interface to editing an HTML snippet. This snippet is then
>saved, and a Page Template reads it and inserts its contents when the
>page is viewed.
>
>Sometimes, after editing and saving a page, when I view it, I get a
>UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position
><some position>: ordinal not in range(128).
"0xa0" is a non-breakable "space".
Apparently, your WYSIWYG editing snippet uses non ASCII
characters for fancy effects.
They are transfered and stored in Zope as Unicode.
You must tell Zope what encoding it should use for
result pages. You do that by
RESPONSE.setHeader('Content-Type', 'text/html; charset=<your charset>')
"<your charset>" is something adequate, e.g. "utf-8" or
"iso-8859-1" (Latin-1).
--
Dieter
More information about the Zope
mailing list