Unicode support, device names interpreted as ascii
Closed this issue · 1 comments
As reported by a user:
from cozify import hub, multisensor
devices = hub.getDevices()
print(multisensor.getMultisensorData(devices))
Traceback (most recent call last):
File "", line 1, in
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 34: ordinal not in range(128)
Likely it's a simple case of my testing not having devices with unicode names. Will verify and do proper unicode handling instead of assuming ascii.
TL;DR; nothing we can really do on the library side. The device names are utf-8 and if the system doesn't support it, there's very little the library can do. So solutions for users are either changing their system locale to a utf-8 one, overriding it just for python-cozify or doing really nasty encoding changes inside nested dictionaries.
I've added a section titled "Encoding Pitfalls" to README.rst in the devel branch.