Thank you for your suggestions.
As I'm not uploading text files from the browser, I don't need to 
encode/decode, I just need to set default encoding to utf8. 
Considering that, I've gone ahead with Alfonso's suggestion and I've moved 
sys.setdefaultencoding('utf8') inside my routes.py. 
It's working smoothly :)

Thanks again!
Best regards,
Lisandro.

El sábado, 6 de julio de 2019, 13:23:38 (UTC-3), Alfonso Serra escribió:
>
> sys.setdefaultencoding will work thorough the server execution process. So 
> as long it is alive you wont need to call it several times.
>
> It will probably work if you set that up on routes.py or web2py.py so its 
> not called per request. 
>
> As long as it fixes your problem i wouldnt care whether it is a bad 
> practice. Python 2.7 by default encodes in ascii so there is not a 
> workaround other than changing the default encoding.
>
> I believe it fixes encoding issues from strings coming from your app, but 
> you will have to encode/decode at some point f you are uploading text files 
> from the browser.
>
>
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/825144d9-b01e-4faf-9ef5-d4c9ee93d330%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to