#-*-coding:utf-8-*-
def teste():
x="Oito bits - informática"
return response.json([x])
[image: image.png]
[image: image.png]
Em sex, 21 de dez de 2018 13:26, António Ramos <[email protected]
escreveu:
> Hello i have this var in my code after reading a webservice.
>
> x='OITO BITS - INFORM*\xc1*TICA, LDA. '
>
> i want to return from my controller
> 'OITO BITS - INFORM*Á*TICA, LDA. '
>
>
> this is my relevant code
> res=[]
> x='OITO BITS - INFORM*\xc1*TICA, LDA. '
> z=x.encode('latin-1')
> print z >>>> it prints 'OITO BITS - INFORM*Á*TICA, LDA. '
> res.append(x) >>> if i replace x with z i get the error below
> return response.json(res)
>
>
>
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc1 in position 18:
> ordinal
> not in range(128)
> Any help ???
>
> 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 [email protected].
> 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 [email protected].
For more options, visit https://groups.google.com/d/optout.