Fix torque degree char#26183
Conversation
MartinHjelmare
left a comment
There was a problem hiding this comment.
Please run black from the project root:
black --fast homeassistant
|
|
||
| temp_unit = data[key] | ||
| if "\\xC2\\xB0" in temp_unit: | ||
| temp_unit = temp_unit.replace("\\xC2\\xB0", "°") |
There was a problem hiding this comment.
Isn't it possible to solve this by applying the correct encoding at some point in the flow after receiving the request?
There was a problem hiding this comment.
To be honest, I am not a proficient python coder, and this was the only way i was able to correct the units. The posted url is a query string with these characters. Seeing as how this was left effectively broken, I tinkered until I found a working solution. I'm all ears if you have a cleaner solution.
There was a problem hiding this comment.
Can you check if the following would fix your issue:
units[pid] = data[key].decode("utf-8")
|
Do we have another suggestion or should we merge? |
balloob
left a comment
There was a problem hiding this comment.
This is fine, I think that's JSON encoding. Let's merge and see where it goes from there.
Breaking Change:
None
Description:
When sensors are added to home-assistant, those with degree symbols are shown as
\\xC2\\xB0instead of°. This PR corrects the symbol.Related issue (if applicable):
None. Created a PR instead of issue. :-)
Pull request with documentation for home-assistant.io (if applicable):
None
Example entry for
configuration.yaml(if applicable):Nothing changes
Checklist:
tox. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
python3 -m script.hassfest.requirements_all.txtby runningpython3 -m script.gen_requirements_all..coveragerc.If the code does not interact with devices: