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

Non UTF-8 characters in byte data #472

Open
Kane610 opened this issue Jul 15, 2024 · 0 comments
Open

Non UTF-8 characters in byte data #472

Kane610 opened this issue Jul 15, 2024 · 0 comments

Comments

@Kane610
Copy link
Owner

Kane610 commented Jul 15, 2024

home-assistant/core#116223 (comment)

I had a similar issue when upgrading my HA instance from 2024.1.5 to 2024.7.2 yesterday and was about to open a PR when I saw this one that looks similar.

It is probably because you are using non UTF-8 characters in your PTZ label(s) for that camera like I do, e.g. "entrée" (vs "entree"), see in your log file

File "/usr/local/lib/python3.12/site-packages/axis/interfaces/parameters/param_cgi.py", line 39, in _api_request
return params_to_dict(bytes_data.decode()).get("root") or {}
^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 1357: invalid continuation byte
I guess that if you modify L39 of interfaces/parameters/param_cgi.py in the axis library from

    return params_to_dict(bytes_data.decode().get("root") or {}

to

    return params_to_dict(bytes_data.decode(encoding='latin-1')).get("root") or {}

it will work again. Alternative is to rename/only use UTF-8 characters for PTZ labels

Not sure why/when this changed between these two versions but somehow HA locales should be taken into account ('latin-1' is only a workaround that will work for western EU)

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

1 participant