[Zope3-Users] Zope and UTF-8 accentuated characters

Marius Gedminas mgedmin at b4net.lt
Sat Aug 26 08:58:48 EDT 2006


On Sat, Aug 26, 2006 at 02:34:55PM +0200, Stéphane Brault wrote:
>  I have a lot of unicode data with accentuated characters. The trouble
>  is that it is sometimes displayed the right way (in combo boxes,
>  lists,.. ) and sometimes not, especially in text inputs.

I use Unicode data in my Zope 3 applications extensively, and usually
there are no problems.

>  The input data is saved correctly but not displayed correctly (é is
>  saved the following the utf-8 format and displayed as é, which
>  corresponds the utf-8 encoding).

It is customary to store Unicode data in Python's unicode strings rather
than in UTF-8 encoded 8-bit strings.

Can you check what your web browser thinks about the page's charset?  If
it selects ISO-8859-1, then your data is presented correctly, but the
server did not specify the correct Content-Type header.  If the browser
thinks the page is in UTF-8, then the server mishandled the data.

Zope 3 automatically converts Unicode to UTF-8 and adds 'charset=UTF-8'
to the Content-Type header when a view returns a Unicode string.  This
is the recommended way of handling Unicode data in Zope 3, and this is
what happens by default if your views render page templates.

>  I tried defining my templates' charset as utf-8, but that generates lots 
>  of errors. Has anyone an idea on how to solve this problem.

You have not told us enough to diagnose the problem.  Can you reproduce
it with a shortest possible test case?

Marius Gedminas
-- 
Woe unto them that rise up early in the morning -- Isaiah 5:11
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope3-users/attachments/20060826/296f9a69/attachment-0001.bin


More information about the Zope3-users mailing list