Perhaps web2py must retrieve the client's charset and convert
accordingly the input, as the framework uses UTF-8 internally. If
web2py expects always UTF-8, this could be reported as an issue. The
server response could also be re-converted for client's compatibility.

On 5 feb, 10:26, Vladimir Rutsky <[email protected]> wrote:
> 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 encoded in UTF-8. I thing
> encoding of request.post_vars.foo string depends on encoding specified
> in client browser, so I can't always do
> "unicode(request.post_vars.foo, 'utf-8')". Also submitted string can
> be non-valid unicode string, so this should be checked either.
>
> Thanks in advance,
>
> Vladimir Rutsky

Reply via email to