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

2012-02-08 Thread Vladimir Rutsky
Bruno, Alan, thanks for replies!

Actually I hoped that web2py have built-in methods to converting all
input to Unicode strings (since this is tendency for all
applications).

Do web2py guaranties, that input string always converted to UTF-8 from
client browser encoding? I'm not sure.
But if it is then I think Bruno's solution is most applicable with
only note that input value can be not correct UTF-8 string, so it
should be checked or ignored, like so:
 unicode(value, 'utf-8', 'ignore')

--
Vladimir Rutsky


[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 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


[web2py] web2py book license and source

2011-12-26 Thread Vladimir Rutsky
Hello!

Under which license book available at http://web2py.com/book is
distributed? If it is under some open source license, where I can find
its sources?

Regards,
Vladimir Rutsky