Le septidi 17 pluviôse, an CCXXV, deloptes a écrit : > In addition to LANG/LC_ALL, stty iutf8 is needed to tell the terminal what > to do
stty iutf8 is completely unrelated to the problem at hand. The modes in the tty layer have nothing to do with fine control of what is displayed on the tty, especially not UTF-8. They act at a much lower and ancient level: they can control the adding of a CR after each LF (try "stty -onlcr; ls"), or the treatment of the eighth bit of each octet as some kind of parity check, but nothing so fine as combining characters. As for iutf8 specifically. As its name indicates, it works on input, i.e. the treatments of the codes for the keys typed in the tty before they reach the application. More precisely, it configures how the rudimentary line editor in "cooked" mode handles octets with the eighth bit set: if enabled, they are treated as UTF-8, if disabled they are treated as individual characters. For example, if the line buffer contains 0xC3 0xA9, i.e. "é" in UTF-8, and you hit backspace (i.e. the octet for the erase property), with iutf8 enabled it will remove both octets, i.e. the full "é" character, while with -iutf8 it will only remove the 0xA9 and leave the 0xC3. In both cases, it will issue "0x08 0x20 0x08" on echo, erasing the "é" displayed on the tty, but in the second case the 0xC3 will really still be there, invisible. You can check using "stty -iutf8; xxd" for example. (Note: I always issue the stty command on the same line as the testing command as I have "ttyctl -f" in my .zshrc. It prevents applications that terminate prematurely from trashing the tty mode. I can not fathom why it is not the default in all interactive shells.) Regards, -- Nicolas George
signature.asc
Description: Digital signature