Subject: Re: Starting console/terminal Unicode support

From: [email-masked] (Ludovic Courtès)
Date: Fri, 23 Feb 2018 22:41:19 +0100

Hello!

Danny Milosavljevic <[email-masked]> skribis:

> On Wed, 21 Feb 2018 23:21:34 +0100
> [email-masked] (Ludovic Courtès) wrote:
>
>> >> This ‘unicode-start’ procedure is essentially a port of the
>> >> ‘unicode_start’ script from ‘kbd’.  I suppose the justification is to
>> >> make sure we’re using UTF-8 input regardless of what the kernel defaults
>> >> or command-line options are.  
>
> Yeah, but the only way to have it not use utf-8 would be to explicitly pass
> "default_utf8=0" as a command-line parameter.  I think at that point the
> user deserves what he personally asked for :P

(He or she.)  But yeah, that makes sense.

>>In
>> other cases (custom kernel build with different defaults, different
>> kernel command-line settings, etc.), we’d just get it wrong with things
>> breaking down the path, no?
>
> Yes, it would just default to ASCII.  In the big scheme of things it's not so bad.
>
> I just thought that if it causes trouble *and* it's not needed anymore, the
> simplest way is to just remove it.

Yeah.

>> Also, FWIW, systemd’s vconsole-setup.c does exactly that:
>> 
>>   https://github.com/systemd/systemd/blob/master/src/vconsole/vconsole-setup.c#L94
>
> Huh, I wonder why they do it.  systemd is quite new.  I understand that older stuff
> (like kbd) did it because they had to in the Linux 2.4 days - but this?
>
> We should ask them...
>
> Aha, they also have
>
> static int toggle_utf8_sysfs(bool utf8) {
>         int r;
>
>         r = write_string_file("/sys/module/vt/parameters/default_utf8", one_zero(utf8), 0);
>         if (r < 0)
>                 return log_warning_errno(r, "Failed to %s sysfs UTF-8 flag: %m", enable_disable(utf8));
>
>         log_debug("Sysfs UTF-8 flag %sd", enable_disable(utf8));
>         return 0;
> }
>
> so we could in fact directly force the VT driver to do our bidding, or even
> check what's up before trying to write the 'G' (the latter sounds like a hack
> hiding the actual problem, though).

Yeah, we could simply write “1” to that file I guess.

Let’s do that?

Thanks for explaining,
Ludo’.