Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF-8 Error in Docker Container based on Alpine Linux #21

Closed
Programmierfreund opened this issue Dec 23, 2020 · 3 comments
Closed

UTF-8 Error in Docker Container based on Alpine Linux #21

Programmierfreund opened this issue Dec 23, 2020 · 3 comments

Comments

@Programmierfreund
Copy link

Programmierfreund commented Dec 23, 2020

I want to add duplicati-client as new layer on top of the official "nodered/node-red" image in docker hub. I know that there is no locale support of the underlying Alpine Linux. So I added musl-locales-master to my Dockerfile - hoping that this helps also for UTF-8. Unfortunately duplicati-client is still not working in this environment (see below). Does anyone has experience in running duplicati-client on Alpine?

Best regards

PS: On Ubuntu duplicati-client is working fine


$ duc login http://duplicati:8200 --password=my password
Traceback (most recent call last):
File "/usr/bin/duc", line 1372, in
main(**vars(args))
File "/usr/bin/duc", line 97, in main
data = auth.login(data, url, password, verify, interactive,
File "/usr/local/lib/duplicati-client/auth.py", line 126, in login
salt = r.json()["Salt"]
File "/usr/lib/python3.8/site-packages/requests/models.py", line 900, in json
return complexjson.loads(self.text, **kwargs)
File "/usr/lib/python3.8/json/init.py", line 337, in loads
raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

@Programmierfreund
Copy link
Author

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.

Before each r.json call I have to add r.encoding='utf-8-sig' in die program code. Maybe Pectojin can add this in the master code? Otherwise I can add a pull request.

@TheAmitMa
Copy link

I have the same problem. Even on ubuntu container.
@Programmierfreund, Could you please share the fixed version?

Programmierfreund added a commit to Programmierfreund/duplicati-client that referenced this issue Dec 31, 2020
Like described in issue Pectojin#21 (Pectojin#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 asked to share my solution - here it is.
Programmierfreund added a commit to Programmierfreund/duplicati-client that referenced this issue Dec 31, 2020
Like described in issue Pectojin#21 (Pectojin#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.
Programmierfreund added a commit to Programmierfreund/duplicati-client that referenced this issue Dec 31, 2020
Like described in issue Pectojin#21 (Pectojin#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.
@Programmierfreund
Copy link
Author

I have the same problem. Even on ubuntu container.
@Programmierfreund, Could you please share the fixed version?

I have now added two pull requests (unfortnately instead of one). You can see like I have adjusted duplicaty_client.py and auth.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants