Re: stty utf8

From: Jamie Lokier
Date: Thu Feb 19 2004 - 19:22:18 EST


Clayton Weaver wrote:
> In an application that is taking input in utf-8,
> if I want to search, compare, yada yada, I need
> to convert to wchar_t first (for iswspace() et al),

No, most search and compare operations are done directly on UTF-8,
and it's much more efficient to do that than convert to wchar_t.

> Why would not terminals do the same thing?

Because they're made of logic chips which you can't change now, have
ROMs, must be compatible with the VT100 and ANSI escape sequences,
must run over an 8-bit channel...

Mostly because that's the way terminals are. You could design a _new_
terminal protocol but it's not going to be useful because you want to
talk with the existing terminals.

> Done that way, Jamie's delete example is
> backspace-space-backspace and remove sizeof(wchar_t)
> from the input.

You could store wchar_t in the terminal queue, but what would be the
point? Removing a UTF-8 character from the input is _trivial_.

> Ok, it takes more space than operating on the utf-8
> encoding directly, but otherwise why not?

Because there's no point.

-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/