Closed Programmierfreund closed 3 years ago
I think it should be possible to set the encoding in the requests wrapper instead. Fewer code changes and ensures that it's always used. https://github.com/Pectojin/duplicati-client/blob/master/requests_wrapper.py
I'll take a crack at it when I find some time.
Sounds good - thanks for your reply.
I've tried setting it on the result object in each method in the requests_wrapper
. This should be functionally equivalent to your changes but only 5 times (one for each request method supported).
https://github.com/Pectojin/duplicati-client/commit/c1029e1f7b82312fd28c0cc4e179ddf411e86d8c
However, as I was trying to verify that this works I discovered that I can't actually replicate the issue in docker on my machine. So I don't know if it works.
I started a library/alpine:latest
container, installed python3 + py3-pip, installed dependencies, ran the login command and it just works as expected.
Like described in issue #21 (https://github.com/Pectojin/duplicati-client/issues/21) there is an UTF-8-issue when you are calling r.json inside a docker cointainer.
I found a valid solution based on this article: https://www.howtosolutions.net/2019/04/python-fixing-unexpected-utf-8-bom-error-when-loading-json-data/ - easiest way ist described in step 4.
TheAmitMa commented asked to share my solution - here it is.