[web2py] Transparently convert request.vars into unicode strings

2012-02-05 Thread Vladimir Rutsky
Hello! What is the best way to transparently convert all variables in request.post_vars to Python unicode strings? When I submit string with non-ascii characters using AJAX from browser to web2py application I receive usual Python 2.6 string (str) in request.post_vars.foo with submitted string

Re: [web2py] Transparently convert request.vars into unicode strings

2012-02-05 Thread Bruno Rocha
On Sun, Feb 5, 2012 at 11:26 AM, Vladimir Rutsky rutsky.vladi...@gmail.comwrote: unicode(request.post_vars.foo, 'utf-8') Use dictionary comprehension, in models 0.py do: from gluon.storage import Storage request.post_vars = Storage({key: unicode(value, 'utf-8') for key, value in