sapegin / shipit

Minimalistic SSH deployment

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Prints corrupted character sequences on non-Unicode terminals

h3xx opened this issue · comments

Script wrongly outputs utf8 characters to non-Unicode terminals. Here is a screenshot from xterm running without Unicode support, and locale settings for latin1 character set.

screenshot-2015-0616-1106

Standard method of determining what character set the terminal supports is via the LC_CTYPE environment variable.

Here's a screenshot of how the character set of messages are supposed to interact with the locale settings.

screenshot-2015-0616-1112

As you can see, when LC_CTYPE is fr_FR.utf8, Unicode characters are printed, but when LC_CTYPE is fr_FR, they're replaced with their latin1 equivalent.

Good idea for pull request.

Investigating how to solve it in a portable way and running into the inevitability that the script will need a full-fledged gettext message library. See: second system effect.

But hey, if you do that, it'll support internationalization.

This script definitely doesn’t need localization and anything like gettext.

In that case, just use latin1 characters for your line art and it'll be fine.

It’s fine for me and 99% users with utf8.