michael-lazar / rtv

Browse Reddit from your terminal
MIT License
4.64k stars 274 forks source link

Difference apperance when using difference locale #592

Closed takedawilliam closed 6 years ago

takedawilliam commented 6 years ago

I notice one thing about the display

In my locale, when my config is like this

[william@eeepc screenshots]$ 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=

the appearance will be like https://i.imgur.com/DsmVAqI.png

But if my locale config is like this

[william@eeepc ~]$ locale
LANG=C
LC_CTYPE="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_COLLATE="C"
LC_MONETARY="C"
LC_MESSAGES="C"
LC_PAPER="C"
LC_NAME="C"
LC_ADDRESS="C"
LC_TELEPHONE="C"
LC_MEASUREMENT="C"
LC_IDENTIFICATION="C"
LC_ALL=

it shows https://i.imgur.com/Kk6ttak.png

Why does this happen?

michael-lazar commented 6 years ago

The character that should be printed here is a unicode bullet:

The top screenshot is because RTV is trying to display the character, but your terminal doesn't have proper support for that character - maybe you need to use a different font or tweak something in your terminal's settings.

The bottom screenshot is because RTV will try to check the locale to see if you have unicode support enabled, and if you don't it will fall back to only using ASCII characters. This is the same behavior that you get when you start RTV with the --ascii flag.

https://github.com/michael-lazar/rtv/blob/36b9353236acc11be208c4cee2191b9854c9625c/rtv/__main__.py#L152-L156