One of our users complained that bash-5.1 on Solaris 11.4, when started
with LANG=C does not allow Unicode input after changing LANG to a UTF-8
locale until bash is restarted.
I've confirmed this is the default behavior, but can be overridden by
manually changing the readline output-meta flag from off to on:
% env LANG=C bash
bash-5.1$ echo \360\237\220\233
π
bash-5.1$ setenv LANG en_US.UTF-8
bash: setenv: command not found
bash-5.1$ export LANG=en_US.UTF-8
bash-5.1$ echo \360\237\220\233
π
bash-5.1$ bash
bash-5.1$ echo π
π
bash-5.1$ exit
exit
bash-5.1$ echo \360\237\220\233
π
bash-5.1$ bind 'set output-meta on'
bash-5.1$ echo π
π
(In all cases, the bug character was pasted the same way in a GNOME terminal,
bash just displayed it differently in the input command line. Our user was
actually trying it with Chinese text, not emoji, but the results were the
same.)
The documentation specifies that for output-meta "The default is βoffβ, but
Readline will set it to βonβ if the locale contains eight-bit characters."
The convert-meta & input-meta options are similarly documented as locale
dependent.
But none of them say what is expected to happen when the locale changes
after initialization - is the behavior we're seeing expected or are these
variables supposed to be automatically updated when the locale changes?
--
-Alan Coopersmith- [email protected]
Oracle Solaris Engineering - https://blogs.oracle.com/solaris