[Konsole-devel] [Bug 83236] Deleting Arabic text in terminals in response to an interactive command using BACKSPACE will delete the question itself

Egmont Koblinger egmont at uhulinux.hu
Fri Nov 12 18:28:35 UTC 2004


------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
        
http://bugs.kde.org/show_bug.cgi?id=83236        




------- Additional Comments From egmont uhulinux hu  2004-11-12 19:28 -------
I guess this has nothing to do with arabic. I could even reproduce it with
Hungarian which is a Latin left-to-write language.

The bug arises in cooked tty mode whereas the kernel(?) has to be told that
UTF-8 is used so that the terminal driver knows to remove more bytes from the
buffer when a backspace is pressed.

How to reproduce No1:
bash$ cat
type for example xyzáé, press one or two backspaces and then Enter. The line
echoed back clearly shows that each backspace removes only one byte and not
a whole multibyte character.

How to reproduce No2:
bash$ echo -n 'someprompt>' ; cat
now type some non-ascii characters (accented letters, euro sign etc.) and then
press backspace many times. Backspace erases one character as many times as
many bytes (not characters!) were typed at the prompt.

AFAIK the kernel maintains a bit for each terminal telling whether that one
is in UTF-8 mode. The problem is that konsole doesn't set this bit.

There's a patch to stty here:
ftp://ftp.ilog.fr/pub/Users/haible/utf8/
and it's also there inside SUSE 9.2 coreutils source rpm.

If you apply this patch then "stty -a" shows "-iutf8" which means input utf8
mode is turned off. Type "stty iutf8" to turn it on. The bugs discussed above
will disappear then.

Please check http://www.cl.cam.ac.uk/~mgk25/unicode.html (Markus Kunh's famous
UTF-8 FAQ), read the paragraph from "Any Unix-style kernel"... It says only
Linux kernels >= 2.6 have this iutf8 feature, so there may be problems with
other kernels and other Unix systems. So IMHO what konsole should do is that
#ifdef IUTF8 then try to perform the relevant tcsetattr() (either try to
explicitely set or explicitely clear this flag since no-one knows when the
kernel's default will change to utf-8 mode). Also please note that this iutf8
flag should also be changed if utf-8 mode is changed run-time in konsole
(e.g. start an 8-bit terminal and then print \e%G and \e% )



More information about the konsole-devel mailing list