Most terminal emulators don't display right-to-left text correctly, even if they do support Unicode. If you use text in a right-to-left language in your terminal, e.g. for filenames, command arguments, program UI strings and so on, you probably don't like to see the word displayed in reverse.

I'd like to suggest two solutions. Both are quite simple, but the first is probably easier.

Solution 1: mlterm

mlterm is an RTL-supporting terminal emulator. Install the package:

# apt-get install mlterm

The initial appearance may not be the best, but you can easily configure the colors and the fonts, and make it look the way you want. You can either edit the configuration files by hand (see man mlterm) or use the configuration GUI). The GUI can be opened by holding Ctrl and right-clicking inside the mlterm window.

On my system, the "anti alias" option is disabled and I can't enable it in the GUI for some reason. However, mlterm -A has the same result and does work. You can define a Bash alias or change the application menu item to execute mlterm -A instead of just mlterm.

Note that mlterm not only displays RTL text correctly, but also aligns it to the right. The alternative solution, bicon, doesn't do the alignment.

Also, on my system mlterm has a low hinting level of the anti-aliasing, which makes the text less sharp. It annoys my eyes a bit, because I'm used to medium and full hinting on my desktop. Maybe later versions allow configuring the hinting levels.

I checked on another computer with a very similar installation (same OS, same packages), and there I could get very good looking text by disabling both Cairo and Xft in the GUI configuration window. The difference is probably in the system font configuration, but I didn't check it thoroughly.

Solution 2: bicon

bicon is a program you execute after opening a terminal, and until you close it with exit, the RTL text is displayed in the right direction.

It's a young project and there are no releases (yet). You can clone the Git repository and build it from source. The process would look like this (replace URL-HERE with the actual repository clone address):

$ cd /home/joe/git-repos
$ git clone URL-HERE
$ cd bicon
$ ./autogen.sh
$ make
$ su
# make install

Before that, you'll need to have FriBidi installed - both the library and the headers:

# apt-get install libfribidi0 libfribidi-dev

The upstream git repository is hosted on a popular centralized git hosting service that runs on proprietary code, but there is a local mirror on Rel4tion's git server (it synchronizes at least once a day). You can browse it and find clone URLs on the git browser pages. See the index page for the link. For clearnet cloning the URL would be:

git://git.rel4tion.org/bicon.git

After installation, you can open your favorite Unicode-supporting terminal emulator (or a system terminal) and run bicon. Now try a command on some RTL text and make output displays correctly, e.g. echo some text in an RTL language.

bicon determines the language using the LANG environment variable (you can see its value using echo $LANG), but can also take the language two-letter code as a commandline argument, e.g. bicon ir.

If you decide to remove bicon or install a new version, you can uninstall the existing files using:

$ cd /home/joe/git-repos/bicon
$ su
# make uninstall

Terminal Applications

These solutions won't always work with textual user interfaces such as ncurses.

WeeChat

WeeChat has a script biditext.py which displays RTL text in the buffer in a more-or-less readable way. Maybe there are better solutions, please tell me if you find any (I didn't do thorough research yet).

What this solution lacks:

  • Multi-line messages have the lines displayed in reverse order, i.e. first line at the botton and last line at the top.
  • Mixed Hebrew and English aren't aligned correctly because the text alignment direction is always left-to-right (as usual on the terminal).
  • When you type a message, it's displayed backwards, left to right, so spotting typos and reading it before sending is difficult. When sending to the buffer, the words are displayed right-to-left there.

What it does give you:

  • Ability to have conversations in RTL languages. Even if not the most convenient, it's possible and much better than nothing.
  • Enter RTL words into LTR sentences.