DavidMStraub / homeconnect

MIT License
31 stars 16 forks source link

Set encoding to UTF-8 #23

Closed BraveChicken1 closed 1 year ago

BraveChicken1 commented 2 years ago

This PR sets the event stream encoding to UTF-8 to prevent symbol issues.

DavidMStraub commented 2 years ago

Can you please elaborate why this is necessary? Doesn't the HC API send the right encoding in the HTTP header?

BraveChicken1 commented 2 years ago

The unit attribute isn't decoded properly: °C is decoded as °C

DavidMStraub commented 2 years ago

Wouldn't it work to supply this as a kwarg to SSEClient? I find it questionable to hard-code it in the sseclient module. Normally requests should autodetect the encoding.

BraveChicken1 commented 2 years ago

Supplying it as a kwarg wouldn't work because the kwarg is passed to the requests.get method which doesn't allow setting the encoding. It is strange to hard-code it, but I think it's the easiest way to do it.