Hi,

On Wed, Mar 12, 2008 at 04:20:09PM -0300, Marcelo de Moraes Serpa wrote:
> I'm using zope.formlib to generate some HTML forms and I'm having some
> issues with character enconding.
> 
> The schema is like the followng:
> 
> class IBoletoBancarioPaymentOptions( IPaymentProcessorOptions ):
> 
> 
>     dias_de_prazo_para_pagamento  =  schema.Int(
>                                                title = _(u"Nosso número"),

You are using non-ASCII characters directly in the source code.  Do you
have a proper encoding declaration at the top of the file?

http://docs.python.org/ref/encodings.html

> Note that I'm actually using the u thing before the string, however, even
> so, the string is still incorrectly rendered.
> 
> The title and description strings get rendered like:
> 
> "Nosso número" (the ú char is not rendered correctly)

This certainly looks weird.  It seems to be incorrectly encoded *twice*.

> The browser is using UTF-8 enconding.
> 
> I should mention that I'm using Zope 3 formlib through Five in Plone 3.
> 
> How could I solve it? I have no idea where to start.

Specifying the source encoding correctly ought to work.

To help search for the cause of the bug (or bugs) you may want to
try title = _(u"Nosso n\u00FAmero") temporarily.

FWIW the usual way is to use English titles in the source code and
provide a .po file with translations.  I'm not sure how to hook that up
through Five.

Marius Gedminas
-- 
As an aside, UPnP's implementation (which features SOAP, HTTP over
multicast/broadcast UDP, and extremely odd XML) is a must-read for fans of
unnatural and baroque network protocols.
        -- Anthony Baxter

Attachment: signature.asc
Description: Digital signature

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )

Reply via email to