0

I'm currently in a new environemnt, my emacs in terminal displays weird character in files, GUI Emacs works fine. I don't know how to express this, please see the following details:

Text edition:

#include <stdio.h>

int main()
{
\u2506        printf("hello world\n");
\u2506        return 0;
}

Image edition: https://i.stack.imgur.com/b5f0p.png

This "\u2506` characters are displayed in all files I've tried, and the files are displayed correctly in other programs such as vim or less.

I believe this is the problem of my new OS, since it works fine in another environment, and I got the same TERM(screen-256color+tmux) and SHELL(fish shell) in both environments.

How can get this fixed? If you need any info, pelase let me know.

CodyChan
  • 2,599
  • 1
  • 19
  • 33
  • The u2506 character is a "BOX DRAWINGS LIGHT TRIPLE DASH VERTICAL". Do you have some kind of add-on Emacs package that visualizes tab stops? If so, try to disable it and see if the problem go away (maybe start from `emacs -Q`.). To fix the issue, we need to 1) check if the terminal can display the character and (if so) 2) figure out why Emacs thinks it can't. – Lindydancer May 16 '19 at 10:40
  • @Lindydancer Yes, it is the result of `highlight-indents-guide` package. But how can I make my terminals support this? MobaXterm and Mate Terminal don't support it, but Konsole supports it. – CodyChan May 16 '19 at 11:19
  • @Lindydancer And I was wrong, I hardcoded some characters in a file, less and vim don't supprort it either. But I used MobaXterm to access another OS before, it works fine, I believe it is a problem of my new OS, what packages do I need to install? – CodyChan May 16 '19 at 11:23
  • If your terminal can support the character, you can probably tweek the syntax table in Emacs for the character in question. An alternative would be to configure `highlight-indent-guides-character` to use a more common character that the terminal can handle, like `|`. – Lindydancer May 16 '19 at 13:43
  • @Lindydancer MobaXterm terminal supports this character in Ubuntu, it just doesn't support this exact character in this speific OS (RHEL7), do I need to install some packages? I just don't know what packages should I install. – CodyChan May 17 '19 at 01:59
  • @Lindydancer I added my solution. This is the problem of variable LANG of my new OS. – CodyChan Jun 04 '19 at 04:06

1 Answers1

0

I found out that this is the problem of the variable LANG,

$ echo $LANG
en_US

But

$ cat /etc/locale.conf
LANG=en_US.UTF-8
$ localctl status
System Locale: LANG=en_US.UTF-8
...

After I export the LANG to en_US.UTF-8, and problem is gone.

I don't know why echo $LANG returns en_US. This OS is managed by administrator in my company and a lot of files have been changed, and I've been using Linux for several years, and this is the first time this problem happens to me.

Anyway, if anyone has the same problem, please change your LANG variable to en_US.UTF-8.


UPDATE:

Actually, only seeting LANG is not perfect, so now I use export LC_ALL=en_US.UTF-8 in ~/.bashrc

In case other issues happen in the future, you may need to put the following three into ~/.bashrc

export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
CodyChan
  • 2,599
  • 1
  • 19
  • 33