Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Nov 2023 07:15:29 +0000
From:      Gary Jennejohn <garyj@gmx.de>
To:        Christos Margiolis <christos@freebsd.org>
Cc:        freebsd-arch@freebsd.org, bojan.novkovic@fer.hr, imp@freebsd.org
Subject:   Re: HEADS UP: IUTF8 to be enabled by default
Message-ID:  <20231103081529.016be29d@ernst.home>
In-Reply-To: <lrxccjlnihx5pke4hrufgebxmgrrbmlbd246o55phhzyhqlhfp@yxvipsuagrdc>
References:  <lrxccjlnihx5pke4hrufgebxmgrrbmlbd246o55phhzyhqlhfp@yxvipsuagrdc>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 2 Nov 2023 21:43:32 +0200
Christos Margiolis <christos@freebsd.org> wrote:

> Hello again and sorry for the poorly worded previous email,
>
> To give a bit more context, during EuroBSDCon 2023, me and Bojan
> Novkovi? started working on a patch to fix backspacing of UTF-8
> characters in the tty driver. What was happening is if you typed a >1
> byte UTF-8 character and then backspaced it, the driver would actually
> delete only 1 byte from the character, instead of all its bytes, which
> ended up leaving garbage in the buffer since the character wasn't fully
> deleted. To test this, run cat(1), type a UTF-8 character (e.g =E9, =E8,=
 =E0,
> non-latin characters, etc), press backspace only once, and look at the
> output:
>
> $ cat
> ??<backspace>
> ??
>
> Bojan then implemented a new IUTF8 flag for stty [1], which enables
> proper handling for UTF-8 backspacing in the tty driver [2].
>
> In the Phabricator review of the tty(4) patch [3], I proposed the idea
> of having the IUTF8 flag enabled by default. imp@ mentioned that since
> the default locale is UTF-8, having the flag set by default shouldn't be
> a problem.
>
> Two possible solutions I have thought of:
>
> 1. Add IUTF8 to TTYDEF_IFLAG in sys/sys/ttydefaults.h.
> 2. Add a check in tty_init_termios() whether the current locale is
>    UTF-8 (how?), and enable it there.
>

Use getenv("LANG") and check whether UTF-8 is part of the string?

My LANG is set to C.UTF-8, for example.

> What do you think? Could this change cause any side-effects we haven't
> thought about?
>
> Christos
>
> [1] https://cgit.freebsd.org/src/commit/?id=3D128f63cedc14ae21b35f74e11e=
2fe1a5659c58e8
> [2] https://cgit.freebsd.org/src/commit/?id=3D9e589b0938579f3f4d89fa5c05=
1f845bf754184d
> [3] https://reviews.freebsd.org/D42067
>


=2D-
Gary Jennejohn



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20231103081529.016be29d>