On Fri, Aug 08, 2003 at 12:27:52PM +0200, Damjan wrote:
> >  * TTY fixes.  When using the cooked TTY line discipline, the delete key
> >    should delete a full UTF-8 character, not just one byte.
> 
> Hmm this didn't work for me. 
> I applied your combined patch, recompiled the kernel but backspace
> behaviour is still wrong. 

Ah, I see. Probably something in your init scripts is resetting the TTY.

I think I have a much better way.  I wrote a Perl script (sttyutf8) that
allows you to set it yourself.

Usage:
sttyutf8
sttyutf8 on
sttyutf8 off

Chris

#!/usr/bin/perl

use POSIX qw(:termios_h);
sub IUTF8 {0x4000}
my $term = POSIX::Termios->new;
$term->getattr(fileno(STDIN));
my $iflag = $term->getiflag();

my $param = $ARGV[0];
my $changed = 0;
if (!defined($param)) {
        printf "UTF-8 is %s.\n", ($iflag & IUTF8) ? "on" : "off";
} elsif ($param eq "on") {
        if ($iflag & IUTF8) {
                print "UTF-8 is already on.\n";
        } else {
                print "UTF-8 was off, turning it on.\n";
                $iflag |= IUTF8;
                $changed = 1;
        }
} elsif ($param eq "off") {
        if ($iflag & IUTF8) {
                print "UTF-8 was on, turning it off.\n";
                $iflag &= ~IUTF8;
                $changed = 1;
        } else {
                print "UTF-8 is already off.\n";
        }
} else {
        print "Bad option\n";
        exit 1;
}

if ($changed) {
        $term->setiflag($iflag);
        $term->setattr(fileno(STDIN), TCSANOW);
}

Reply via email to