OpenWrt Forum Archive

Topic: No Scandinavian / UTF-8 support in console

The content of this topic has been archived on 14 Mar 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

On root prompt inside my TP-Link router I wrote eight Scandinavian letters ("öäöäöäöä") and deleted them. It looks like this:

root@OpenWrt:~#
root@Ope

The cursor is currently next to the 'e' in 'Ope'. For every single non-ASCII letter I write, I see one, but I get to delete two.

My aim is to have a normal user in my TP-Link and run a screen session. But I need UTF-8 support for console, screen and software running inside screen.

Is this at all possible?

Do I need to build OpenWrt by myself?

Or do I just need to install some packages and do some configuration?

Do I need bash?

Do I need a kernel NLS package, or are these just for SMB/CIFS and filesystem support?

I already have

export LANG=en_US.UTF-8

as my 2nd row in /etc/profile but that doen't help.

Do you recommend I forget about running a normal user (although I already have one) or that I just use ASCII for everything?

(Last edited by Thinkcat on 28 Aug 2016, 12:19)

LMGTFY

TL;DR -

Markus Kuhn wrote:
  • The tty driver of any POSIX system supports a “cooked” mode, in which some primitive line editing functionality is available. In order to allow the character-erase function (which is activated when you press backspace) to work properly with UTF-8, someone needs to tell it not count continuation bytes in the range 0x80-0xBF as characters, but to delete them as part of a UTF-8 multi-byte sequence. Since the kernel is ignorant of the libc locale mechanics, another mechanism is needed to tell the tty driver about UTF-8 being used. Linux kernel versions 2.6 or newer support a bit IUTF8 in the c_iflag member variable of struct termios. If it is set, the “cooked” mode line editor will treat UTF-8 multi-byte sequences correctly. This mode can be set from the command shell with “stty iutf8”. Xterm and friends should set this bit automatically when called in a UTF-8 locale.

Ok. Since stty is not part of current busybox, I installed coreutils-stty. But trying out stty iutf8 had no effect. In addition to LANG, I tried setting LC_ALL, but the result was the same.

Logging into my TP-Link from either Ubuntu 14.04 or OS X El Capitan the problem remained. Both of these do not have the problem by themselves, but only when I am logged in to the TP-Link.

(Last edited by Thinkcat on 29 Aug 2016, 13:44)

'cooked' mode was introduced in the 2.6.4 kernel (yours is...?)

I am running Chaos Calmer (15.05.1, r48532) with 3.18.23. With stty cooked I get "C6" instead of 'ö' and "C$" instead of 'ä'. With stty -istrip after that, I do get 'ö' and 'ä' again, but the problem with deleting them remains. And stty iutf8 doesn't change that.

Thinkcat wrote:

stty iutf8 had no effect.

+1 with LEDE's 4.4.19 kernel.

I made a ticket out of this to dev.openwrt.org and would have linked this conversation to it, but the ticket seems to have disappeared.

(Last edited by Thinkcat on 29 Aug 2016, 23:59)

The discussion might have continued from here.