About encoding url vars

35 views
Skip to first unread message

CarlosDB

unread,
Jun 17, 2022, 12:03:38 PM6/17/22
to py4web

I am having a problem passing some values in the url.

I put a simple example:


from py4web import redirect, URL


@action("test")
def test():
    valor = "niña"
    redirect(URL("test2", vars=dict(valor=valor)))


@action("test2")
def test2():
    print(request.query.get('valor'))


test redirects to test2. The result that is printed is:

niña

But I expected to get:

niña

In web2py I do something similar and it works like esterp.

Is there something wrong or do I have to do it another way?

Thanks.
Carlos.



Val K

unread,
Jun 17, 2022, 12:45:19 PM6/17/22
to py4web
it's a bottle compatible issue
use 
request.query.some 
or
 request.query.getunicode()

пятница, 17 июня 2022 г. в 19:03:38 UTC+3, CarlosDB:

Val K

unread,
Jun 17, 2022, 12:49:28 PM6/17/22
to py4web
request.query.getunicode('some')

пятница, 17 июня 2022 г. в 19:45:19 UTC+3, Val K:

CarlosDB

unread,
Jun 17, 2022, 2:14:13 PM6/17/22
to py4web
Thanks.
request.query.getunicode('some') works fine.
Reply all
Reply to author
Forward
0 new messages