Request values with accents (UTF-8) are converted to None

28 views
Skip to first unread message

Christian Varas

unread,
Aug 8, 2022, 6:51:36 PM8/8/22
to py4web
Hi, I noticed that Form is not handling values correctly with accents or utf8 characters.

using a simple form with the string: acción
image.png

controller: 
form_lugar = Form([Field('nombre', 'string')], formstyle=FormStyleBootstrap4)

if form_lugar.accepted:
     print(form_lugar.vars)
     print(request.forms.get('nombre'))

the following prints this:
 
{'nombre': None, '_formname': 'no_table', '_formkey': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0cyI6IjE2NTk5OTg1ODEuMDE4NTIyIn0.z3mJs_ACe6i1SY4i4_Hz67PwXbnIRH3qzJqtXXRqnOE'}
None

Any help is appreciated.

Cheers.
Chris.

Christian Varas

unread,
Aug 8, 2022, 7:40:36 PM8/8/22
to py4web
I was able to fix this by setting to False the following parameter in ombott/request/helpers.py

line N° 143
    recode_unicode = False

but I don't know  if this can bring undesired effects.
By now strings with accents are working properly.


Cheers.
Chris.
Reply all
Reply to author
Forward
0 new messages