Re: [PATCH]console:UTF-8 mode compatibility fixes

From: Andrew Morton
Date: Sat Feb 18 2006 - 05:59:17 EST


Adam Tla/lka <atlka@xxxxxxxxx> wrote:
>
>
> This patch applies to 2.6.15.3 kernel sources to drivers/char/vt.c file.
> It should work with other versions too.
>
> Changed console behaviour so in UTF-8 mode vt100 alternate character
> sequences work as described in terminfo/termcap linux terminal definition.
> Programs can use vt100 control seqences - smacs, rmacs and acsc characters
> in UTF-8 mode in the same way as in normal mode so one definition is always
> valid - current behaviour make these seqences not working in UTF-8 mode.
>
> Added reporting malformed UTF-8 seqences as replacement glyphs.
> I think that terminal should always display something rather then ignoring
> these kind of data as it does now. Also it sticks to Unicode standards
> saying that every wrong byte should be reported. It is more human readable
> too in case of Latin subsets including ASCII chars.
>
> ...
>
> - } else if (vc->vc_utf) {
> + } else if (vc->vc_utf && !vc->vc_disp_ctrl) {
> /* Combine UTF-8 into Unicode */
> - /* Incomplete characters silently ignored */
> + /* Malformed sequence represented as replacement glyphs */
> +rescan_last_byte:
> if(c > 0x7f) {
>
> ...
>
> + if (vc->vc_npar) {
> + c = orig;
> + goto rescan_last_byte;
> + }
>
> ...
>
> + }
> + vc->vc_utf_count = 0;
> + c = orig;
> + goto rescan_last_byte;
> + }
> continue;
> }

I spent some time trying to work out why this cannot cause an infinite loop
and gave up. Can you explain?
-
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/