[z3-five] Re: Extended characters in forms
Martijn Faassen
faassen at infrae.com
Mon May 23 11:04:00 CEST 2005
Hey,
Finally getting back to this "fun" topic..
Lennart Regebro wrote:
> On 5/12/05, Lennart Regebro <regebro at gmail.com> wrote:
>
>>On 5/11/05, Lennart Regebro <regebro at gmail.com> wrote:
>>
>>>This does not work. If you have a character like ä in a form, the
>>>widgets try to do unicode(input) on it and you get a
>>>UnicodeDecodeError, 'ascii' codec can't decode byte 0xe5 in position
>>>0: ordinal not in range(128).
>>>
>>>How to fix?
>>
>>No-one?
>>
>>So far I have three ideas, none of the good:
>>1. Force people to change the default encoing in site.py.
This we cannot possibly recommend, as this is evil and will break other
stuff...
>>2. Monkey-patch Zope3 to stop it from converting everything to unicode.
Looking at the code, I think this is next to impossible; the default
values on some widget classes are u'' and a unicode error comes up when
a == comparison is done with a non-ascii non-unicode string. I'd also
not recommend it as using unicode internally makes sense..
>>3. Do some magic so everything in these forms is converted to unicode
>>with the charset encoding in the for request.
>
> I tried #3, and you get problems with things that are for example
> lists of strings, so that didn't work.
Hm, how did you try #3? I think #3 is most similar to what the Zope 3
publisher itself does, though I still need to go study it.
Regards,
Martijn
More information about the z3-five
mailing list