Re: formencode and toscawidgetsforms interaction

"David Smith" <[email protected]>
Newsgroups gmane.comp.python.formencode
Organization TriAx Corp
Message-ID <[email protected]>
Hi Alberto and thanks very much for the fast response.

I might have sent my previous patch as a 7bit file and transhed
the utf-8 encoding of the data I had in the test case, but for
whatever reason the string that ended up in there is an (high
order) ascii string, not a python unicode string, and thus
doesn't provoke the error. Please replace it with
u'\u5bae\u672c' (it should be two characters that look like
宮本 when decoded as appropriate and printed).

Sorry about that, and here's hoping the tests fail properly
this time! :)

David

Alberto Valverde <[email protected]> writes:

> On Jan 9, 2007, at 9:07 AM, David Smith wrote:
>
>> Hi all,
>>
>> I was experimenting with using ToscaWidgetsForms and tried
>> using a UnicodeString field in a ListForm which proceeded to
>> die with a Unicode decode error. I traced this to formencode's
>> UnicodeString validator automatically encoding the unicode
>> object into utf-8 which genshi then tried to use in a
>> u''.join([value]) form, which causes the error.
>>
>> Thus, you cannot currently use non-ascii strings with
>> ToscaWidgetsForms fields.
>>
>> I've attached a patch to toscawidgetform's test_forms.py to
>> demonstrate.
>>
>> I believe the solution is that UnicodeString's from_python
>> should not encode the string. Would that cause a problem for
>> anyone?
>
> I've just comitted the tests you provided to TW (thanks!) and they
> all pass. I'm using FE 0.6 so I guess it's fixed in FE already, what
> version of FE are you using? Just in case I've bumpled TW's
> requirement to FE 0.6.
>

--
  David D. Smith

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
FormEncode-discuss mailing list
FormEncode-discuss-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/formencode-discuss
signature.asc (application/pgp-signature, 188 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFFo6JUEJGOueZRHH4RAkL0AJ4mImI+VDDjWVsKIDpGPypAi6lLpgCeJ1Tg
TkDRdnU6d8SrqsHtugRwdJ0=
=2iui
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.