Search code examples
gittmux

git converts characters like ✓ and ✗ to underscore (_)


I have a git repository which contains my .bashrc and therefore the following content:

...
PROMPT_DIRTY=" \[\033[1;31m\]✗\[\033[0m\]"
PROMPT_CLEAN=" \[\033[1;32m\]✓\[\033[0m\]"
...

If I'm cloning this repo on an Archlinux distribution I get exactly this (the above) output. But if I'm cloning the repo on a Debian (tried multiple versions) or FreeBSD 10.0 then I'm getting the following:

...
PROMPT_DIRTY=" \[\033[1;31m\]_\[\033[0m\]"
PROMPT_CLEAN=" \[\033[1;32m\]_\[\033[0m\]"
...

I.e. the special chars ✓ and ✗ are converted into an underscore (_).

Does someone know why this is happening? I would like to have the original special non-alphanumerical characters instead of the underscore.


Solution

  • I've used tmux to view the .bashrc file. The problem laid in tmux disabled UTF-8 support.

    According to the manpage, tmux tries to guess the UTF-8 support by looking at the LC_ALL, LC_CTYPE, and LANG environment variables for the string "UTF-8". You can force tmux UTF-8 support with the "-u" argument.

    In my case tmux guessed wrong although my LANG environment variable was set to a UTF-8 locale. So tmux didn't recognize the "UTF-8" string but after I called tmux with the "-u" flag, and therefore force UTF-8 support, everything looks as expected.

    Thanks, @IQAndreas for pointing to the solution.