BasioMeusPuga / twitchy

CLI streamlink wrapper for twitch.tv
GNU General Public License v3.0
91 stars 14 forks source link

Issues showing the letters "åäö" in stream titles #7

Closed Hund closed 7 years ago

Hund commented 7 years ago

Titles with the å, ä and ö like "Semesterlir med Rönnlund" becomes "Semesterlir med Rönnlund".

I'm using Arch Linux, URxvt 9.22 and twitchy-git r133.478dddf from AUR.

BasioMeusPuga commented 7 years ago

I'm unable to reproduce this on konsole, gnome-terminal, and urxvt. That exact status form this issue (from the geekslive stream?) shows up the way it should along with the other special characters you've mentioned.

I'm afraid this might be an issue with your terminal config, or more specifically, your terminal font. Try messing with locale settings too, just for kicks.

Hund commented 7 years ago

Hm, weird. I've tried using Bash, Zsh, URxvt, lxterminal, Kterminal and various fonts. Same issue. :( It did work when I listed past broadcasts with -b though.

BasioMeusPuga commented 7 years ago

So a little research tells me this is definitely a locale issue. I was able to reproduce this with my encoding set to ISO-8859-1. I've since updated the script to force UTF-8.

Please check and see if this breaks anything?

Hund commented 7 years ago

I'm now running version r135.a8d88c1-1 and I still have the same issue. :(

BasioMeusPuga commented 7 years ago

What is the output of $ locale on your system?

Hund commented 7 years ago
$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8
BasioMeusPuga commented 7 years ago

We're officially in 'Well, shit' territory now. Could you replace line 776 with

status_message = stream_data['streams'][i]['channel']['status'].encode('latin-1', 'ignore').decode('utf-8')

and tell me if that changes anything?

Hund commented 7 years ago

Hehe. :)

$ ./twitchy.py
 Checking 50 channel(s)...
Traceback (most recent call last):
  File "./twitchy.py", line 1353, in <module>
    main()
  File "./twitchy.py", line 1348, in main
    watch(None, '')
  File "./twitchy.py", line 808, in watch
    get_status(status_check_required)
  File "./twitchy.py", line 776, in get_status
    status_message = stream_data['streams'][i]['channel']['status'].encode('latin-1', 'ignore').decode('utf-8')
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 40: invalid continuation byte
Hund commented 7 years ago

Hm, weird. I undid the change and ran the file as is and it worked then. Dunno why, but it works now. :)