AppDaemon / appdaemon

:page_facing_up: Python Apps for Home Automation
Other
855 stars 419 forks source link

umlauts getting lost when fetching data from Home Assistant #990

Closed prankousky closed 4 years ago

prankousky commented 4 years ago

Hi,

I am trying to grab media_artist and media_album_name from an mpd entity within Home Assistant.

grafik

As you can see, the artist name is Die Ärzte, with the German Umlaut Ä. I am trying to write an AppDaemon app to fetch the appropriate album cover via last.fm API, which requires me to pass on the artist and album name.

However, when I try using this (test case is self.log(artist_name)), I get something like Die <?><?>rzte. The two question marks are within a box, but I cannot copy and paste the exact output at the moment. So it's not bracket, question mark, bracket, but some weird symbol character.

This will also happen when I self.log("Die Ärzte"), so I don't think the problem is fetching the data from Home Assistant, but rather some general issue working with characters like these. Is there something I have to do in order to enable encoding?

I searched the docs for encoding and umlaut, but didn't find anything that helps me solve this issue.

Thank you for you reply :)

ReneTode commented 4 years ago

its only in the logeditor that you use. the problem isnt in AD, but in the editor.

if you use: self.set_state("sensor.artist_name", state = "Die Ärtze") a sensor gets created and that sensor shows that the value is correct.

prankousky commented 4 years ago

Perfect, thank you.