3

E.g., on the bash command line I can type a δ character using the Compose key and an ad hoc ~/.XCompose file, but if I try to do the same in Gnuplot what I get is

13:48 boffi@debian:~ $ δ
bash: δ: command not found
13:48 boffi@debian:~ $ gnuplot

        G N U P L O T
        Version 5.2 patchlevel 6    last modified 2019-01-01 

        Copyright (C) 1986-1993, 1998, 2004, 2007-2018
        Thomas Williams, Colin Kelley and many others

        gnuplot home:     http://www.gnuplot.info
        faq, bugs, etc:   type "help FAQ"
        immediate help:   type "help"  (plot window: hit 'h')

Terminal type is now 'qt'
gnuplot> δ

The best answer will teach me how to make Gnuplot accept Unicode characters, a good answer will explain why Gnuplot does not accept Unicode characters.

13:53 boffi@debian:~ $ env | grep LANG
LANG=C.UTF-8
Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
gboffi
  • 1,220
  • 1
  • 14
  • 30
  • 1
    I can confirm this kind of breakage on a fully UTF-8 Ubuntu 18.10. I'm not familiar with gnuplut, but there shouldn't be such a configuration in any app, it should just work. I think you should contact gnuplot's developers. – egmont Jan 23 '19 at 13:20

1 Answers1

3

gnuplot in Debian is built with the editline library to handle history on the gnuplot command-line, and that doesn’t support UTF-8; in fact the configure script mentions that:

  --with-readline=builtin  use the built-in readline
  --with-readline=gnu      use the GNU readline library (default if present)
  --with-readline=bsd      use the NetBSD editline library (NB: does not handle UTF-8!)

There is a 15-year-old bug about this behaviour, #273002, with a corresponding gnuplot feature request, #265 (which is closed, presumably because it was fixed by the addition of the internal implementation of readline).

Fedora uses the built-in readline and doesn’t suffer from this bug. (It does, however, suffer from other bugs — try entering ‘δ’ and then backspacing.)

To fix this, rebuild the Debian package:

cd /tmp
apt source gnuplot
cd gnuplot-5.0.5+dfsg1
sed -i 's/readline=bsd/readline=builtin/' debian/rules
sudo apt install devscripts equivs
mk-build-deps debian/control
sudo apt install ./gnuplot-build-deps_5.0.5+dfsg1-6+deb9u1_all.deb
mv ./gnuplot-build-deps_5.0.5+dfsg1-6+deb9u1_all.deb ..
dch -n "Use built-in readline."
dch -r ignored
dpkg-buildpackage -us -uc
sudo apt purge gnuplot-build-deps

This will produce gnuplot packages in the parent directory, which you can install using sudo dpkg -i.

Stephen Kitt
  • 411,918
  • 54
  • 1,065
  • 1,164
  • 1
    Just curious, `readline=gnu` supports UTF-8, doesn't it? and... why on Earth Debian chooses `readline=bsd` as its default (overriding `configure`'s default)? is BSD readline implementation better under different points of view? – gboffi Jan 23 '19 at 16:17
  • 1
    The `readline` license is deemed to be incompatible with gnuplot’s. – Stephen Kitt Jan 23 '19 at 16:31
  • A remark, I had already installed `devscripts` but `mk-build-deps` failed, asking me to install `equivs` — after `sudo apt install equivs` the build proceeded w/o problems but the need to reinstall Emacs, for some reason the build procedure needed `emacs-nox25` so that Emacs 26 was removed, no problem I reinstalled it later. – gboffi Jan 23 '19 at 17:02