I have started another thread called
How does web2py save JSON fields?

because i think its the json field that is messing my data on save

thank you

2016-08-19 14:03 GMT+01:00 Richard Vézina <ml.richard.vez...@gmail.com>:

> You have to URL unquote not request.vars.... http://
> stackoverflow.com/questions/16566069/url-decode-utf-8-in-python
>
> If you do request.vars.yourvarname what do you have?
>
> You can try request.vars.yourvarname.decode('utf-8')
>
>
> Richard
>
>
> On Thu, Aug 18, 2016 at 7:24 PM, António Ramos <ramstei...@gmail.com>
> wrote:
>
>> Sorry to insist but cant find any clue.
>> I tried a simple http post from fiddler or postman
>>
>> i sent a Post  to my controller with
>> Content-Type: application/json; charset=utf-8
>> and in the body
>> {"Sistema de Gestão da Qualidade":1,"b":2}
>>
>> and i get in request.vars
>> {u'Sistema de Gest\xe3o\x00 \x00d\x00a\x00 \x00Q\x00u\x00': 1, 'b': 2}
>>
>> How do i get "Sistema de Gestão da Qualidade" from the request.vars?
>>
>> Regards
>> António
>>
>>
>>
>> 2016-08-18 19:49 GMT+01:00 Richard Vézina <ml.richard.vez...@gmail.com>:
>>
>>> I think it url encoded... Search google about it, it should be obvious
>>> then...
>>>
>>> Richard
>>>
>>> On Thu, Aug 18, 2016 at 2:12 PM, António Ramos <ramstei...@gmail.com>
>>> wrote:
>>>
>>>> Im getting this data on request.vars from Google forms onsubmit event.
>>>>
>>>> u'Sistema de Gest\xe3o\x00 \x00d\x00a\x00 \x00Q\x00u\x00'
>>>>
>>>> how do i convert it to
>>>> "Sistema de Gestão da Qualidade"
>>>>
>>>> i tried urllib.unquote(x).decode('utf-8')  in my controller
>>>> def getit():
>>>>     ret={}
>>>>     for x in request.vars:
>>>>         temp=urllib.unquote(x).decode("utf-8")
>>>>         ret[x]=request.vars[x];
>>>>     db.responses.insert(allresponses=ret)
>>>> but my responses.allreponses document is saved as the same value
>>>> {u'Sistema de Gest\xe3o\x00 \x00d\x00a\x00 \x00Q\x00u\x00': 'testing'}
>>>> Allresponses field is a JSON Field
>>>>
>>>>
>>>>
>>>> Regards
>>>> António
>>>>
>>>> --
>>>> Resources:
>>>> - http://web2py.com
>>>> - http://web2py.com/book (Documentation)
>>>> - http://github.com/web2py/web2py (Source code)
>>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "web2py-users" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to web2py+unsubscr...@googlegroups.com.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> --
>>> Resources:
>>> - http://web2py.com
>>> - http://web2py.com/book (Documentation)
>>> - http://github.com/web2py/web2py (Source code)
>>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>>> ---
>>> You received this message because you are subscribed to the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to