40

I'm trying to write Arabic in the terminal app but it does not recognize right-to-left text and does not bind the Arabic letters together as it should.

I tried this solution https://bugs.launchpad.net/ubuntu/+source/vte/+bug/263822 but it did not work.

Are there any plans to implement Arabic support in the gnome terminal? KDE Konsole terminal works without any problems.

This is what is needed in a terminal to support Arabic:

  1. Arabic letters need to be displayed correctly with a font that supports Arabic, from right to left, with the letters taking the correct forms (letters in the same word are joined together, usually, we want to see على not ع ل ى)
  2. It needs to support diacritic marks (known as shakl شَكْل in Arabic)
  3. There needs to be a way to enable right-to-left mode for the entire line. For example, the word على followed by a . should be displayed with the dot on the left, not the right.
  4. There needs to be a way to align the text of the line to the right, not to the left.

Here is an example of four properties being met in Gedit:

Gedit screenshot

However, GNOME Terminal in Ubuntu 21.10 only supports properties 1 and 2 of the previous list of requirements:

GNOME Terminal screenshot

(The letters are displayed correctly right to left, however, the dot is on right when it should be on the left, and the text is left-aligned rather than right-aligned.)

Flimm
  • 40,306
  • 22
  • 94
  • 154
Pore
  • 401
  • 1
  • 4
  • 3
  • 1
    What happened when you tried https://bugs.launchpad.net/ubuntu/+source/vte/+bug/263822? – N.N. Nov 19 '11 at 10:06
  • 2
    why do you need write Arabic in the terminal and why do you want it right to left ??? – Black Block Nov 19 '11 at 23:24
  • 2
    **FYI:** Arabic is normally written _right to left_. As are several others languages, with old Hebrew even switching between _right to left_ and _left to right_. Traditional Japanese writing start from the top-right of page and goes down in a column, with the next 'line' of glyphs to the right. That also gives them books that are read from the right cover, turning pages to left, until the end of the book (Western front cover) is reached. – david6 Nov 22 '11 at 05:06
  • Do you need both _left to right_ and _right to left_, during any given session? Are you using terminal emulation (escape sequences, full-screen, field layout), or is this ONLY for command line? – david6 Nov 22 '11 at 05:09
  • @Naruto for me, I need the Arabic support because I use a treminal IRC client and joining an Arabic channel would show distorted words in the client. Not sure about him. – Suhaib Nov 26 '12 at 05:24
  • Since you are extending an old question, it is difficult to tell your current status, and therefore post suggestions for *your* case. Please: 1) Post what you tried: fribidi, bicon ([apparently not needed](https://gist.github.com/IslamAzab/49428f09cffc4f453be9?permalink_comment_id=3025476#gistcomment-3025476)), etc. 2) Try Konsole, and report results ([ref](https://bbs.archlinux.org/viewtopic.php?pid=1726490#p1726490)), perhaps it is a good-enough alternative for you. – sancho.s ReinstateMonicaCellio Feb 28 '22 at 10:17

6 Answers6

11

For Ubuntu 64 bit, you would need to download BiCon, the Bidirectional Console. To add the PPA and install:

sudo add-apt-repository ppa:behnam/ppa
sudo apt-get update
sudo apt-get install bicon

I guess you were having a dependency problem. You would need also to install the apps stated above with this command:

sudo apt-get install libfribidi0 libfribidi-dev

Hope that this could help

Flimm
  • 40,306
  • 22
  • 94
  • 154
Mijo
  • 293
  • 1
  • 3
  • 8
10

Use Mlterm, It's has great support for Arabic and other non-latin characters. You can download it from Ubuntu repositories:

sudo apt install mlterm

Picture of Mlterm showing Arabic

Flimm
  • 40,306
  • 22
  • 94
  • 154
Damascene
  • 101
  • 1
  • 3
  • You can download it from Ubuntu repositories – Damascene Jan 02 '16 at 21:28
  • You can edit your question to append the content of your comment and make it more useful. – Jakuje Jan 02 '16 at 23:39
  • @Flimm make sure the encoding setting are iso-8859-6 or windows, or ibm equivalents – Error Nov 17 '17 at 22:05
  • @Error I tried mlterm recently and it seemed to work. I'm glad I didn't have to try iso-8859-6 to be honest, life is so much simpler when everything uses UTF-8. – Flimm Nov 18 '17 at 07:08
  • If you want to use Vim in Arabic, see [`arabic.txt`](http://vimdoc.sourceforge.net/htmldoc/arabic.html) and [`'termbidi'`](http://vimdoc.sourceforge.net/htmldoc/options.html#'termbidi') – Flimm Apr 20 '20 at 10:46
9

try this: sudo apt-get install libfribidi0 libfribidi-dev, install THIS package, then vim /usr/share/applications/gnome-terminal.desktop and add this code to the document:

Terminal=true
Exec=/usr/bin/bicon.bin
avery_laird
  • 144
  • 4
  • In Ubuntu 13.04, I installed those packages but can find bicon.bin anywhere... – Ba7a7chy Apr 30 '13 at 19:01
  • I want to get fribidi working on Linux Suse. I have installed Fribidi, following the installation man in its official website, however I don't see a change in terminal. And trying `zypper install libfribidi0` I get the error: `Loading repository data... Reading installed packages... 'libfribidi0' not found in package names. Trying capabilities. No provider of 'libfribidi' found. Resolving package dependencies.` Have been searching and not getting a single result. What packages am I supposed to have? – Neeku Jun 30 '14 at 12:05
8

GNOME Terminal 3.34 supports right to left scripts such as Arabic.

The work actually went into VTE version 0.58, so any other terminal emulator using VTE (e.g. Tilix, Terminator, Xfce Terminal, Guake...) will automatically receive it.

It's going to debut in Ubuntu 19.10 Eoan Ermine.

Screenshot

Flimm
  • 40,306
  • 22
  • 94
  • 154
egmont
  • 7,790
  • 1
  • 27
  • 37
  • 3
    I found that I still needed to change the font in gnome-terminal to something like "Monospace Regular" in Ubuntu 20.20. The default font seems to be "Ubuntu Mono Regular" and it doesn't seem to display Arabic letters well in gnome-terminal (the letters seem to overlap). – Flimm Apr 20 '20 at 10:29
  • Good point, it's indeed up to the user to pick a decent font. Font fallback is a complicated story I'm not familiar with. Even if "Ubuntu Mono" is monospace, it could lack Arabic and could fall back to a non-monospace font for Arabic glyhps. Or something like this. Also thanks for adding a screenshot! :) – egmont Apr 20 '20 at 16:12
  • In `Debian 10+xfce4` The `libvte` package version is: `0.54.2-2` and xfce4-terminal: `0.8.7.4-2`, By upgrading libvte through sid repository and install `0.60.3-1` its support rtl language like Persian. – EsmaeelE Jun 18 '20 at 22:54
  • This does display the letters from right to left. However, it doesn't set right-to-left mode for the whole line (try printing an Arabic word followed by `.` and you'll see that the dot ends up on the right, but it should be on the left). Also, the text isn't right-aligned. – Flimm Feb 23 '22 at 14:21
  • It's literally impossible to have a "magic wand", implement RTL support entirely in terminals, retroactively and perfectly for all apps. The terminal can only become an RTL-friendly _platform_, not a complete out-of-the-box solution for all your BiDi needs. There are several possible modes (e.g. whether the "paragraph direction", and in turn, alignment is autodetected or set to LTR or set to RTL). Even outside of terminals, there's no golden answer here. Applications or users have to select the mode that best fits their needs. See the proposed "BiDi in Terminal Emulators" spec for details. – egmont Feb 23 '22 at 17:58
4

Update

As egmont mentioned in his comment below, a BiDi implementation is coming to vte terminal emulator. Check his answer which is the last updated concerning this topic.

Here is a reference if looking for details: https://terminal-wg.pages.freedesktop.org/bidi/


Original answer

No, there is no plans to implement RTL support in gnome-terminal or any terminal depends on vte as the case of synaptic installation terminal.

  • You may proxy your command through fribidi command to make bidi & basic shaping of Arabic.
  • You may also use konsole (KDE) or mlterm that had implemented a partial support for Unicode bidi and shaping.

Currently, there is no correct way to implement those Unicode algorithms for the consoles. (Those implementions in konsole & mlterm are kind of workaround)

Here is a portion from a Behdad Esfahbod's post, he is the main developer of HarfBuzz (hb for short, an OpenType text shaping engine)

Terminal emulators with support for complex text are very weird hybrids. On the one hand terminal emulators have to lay text out in a predefined grid in a predefined way, which is in conflict with many aspects and requirements of complex text, on the other hand users demand support for complex text in their terminals. It gets uglier when you think about bidirectional text, say, inside a console text editor. Nonetheless, it is fair to say that such hybrids do not put any new demands on the shaping engine. gnome-terminal currently has no support for complex text other than combining marks. Konsole has bidirectional text support. Apple's Terminal App has at least bidi support as well as Arabic shaping support, not sure about other complex text. Update (Jan 18, 2010): The terminal mode (term and ansi-term) in recent versions of Emacs can render complex text, including Indic.

Source: State of Text Rendering

Here is the corresponding bug report in Launchpad bug #263822: RTL (right to left) support in terminal (BiDi).

user.dz
  • 47,137
  • 13
  • 140
  • 258
  • 1
    "No, there is no plans to implement RTL support in `gnome-terminal` or any terminal depends on `vte`" – This was true when you posted this answer, and is fortunately no longer the case. See my answer for update. – egmont Sep 12 '19 at 11:07
2

There are three more solutions:

  1. use tabby (an electron app - web based):

enter image description here

  1. use Konsole (the default emulator for KDE distros):

    sudo apt install konsole

enter image description here

  1. use butterfly (a pure web based terminal):

enter image description here

thank you @singrium

Flimm
  • 40,306
  • 22
  • 94
  • 154
  • Terminus was renamed to Tabby. It actually doesn't support Arabic at all any more. At least it didn't when I tried it just now. – Flimm Feb 23 '22 at 14:30