Output alignment fails with multibyte characters
I'm working on the Swedish translation of procps_ng. There are many tips and advice for us translators to get the translation fit in various column headers etc. That is very helpful and appreciated.
However, although I follow the instructions, columns still don't line up as expected. I get the impression the tools do not understand multi byte encodings; rather assuming a byte equals a character. This is most notable in top, but also e.g. pmap -X has the same problem.
As an example, see below the output of the default page in top. Note how all column headers after “ANVÄND.” are one position to the left. (The same problem affects the actual task lines where the user name is “göran”, also containing non-ASCII. But admittedly, that is non-standard.)
Similar issues affects the fields management page; for any header containing non-ASCII, the following equal sign is displaced one position to the left. On the help page, the explanations are truncated too early, not allowing all 80 columns to be used, and in two cases truncating half way through a character.
top - 21:45:16 up 16 days, 11:39, 24 users, load average: 1,34, 1,51, 1,31
Uppgifter: 317 total, 1 running, 316 sleeping, 0 stopped, 0 zombie
%Cpu/er: 4,8 us, 4,6 sy, 0,0 ni, 87,4 id, 0,2 wa, 0,4 hi, 2,5 si, 0,0 st
KiB Minn: 15668616 total, 3025596 free, 3151560 used, 9491460 buff/cache
KiB Växl: 33554424 total, 33540088 free, 14336 used. 12042016 avail Minn
PID ANVÄND. PR NI VIRT RES DELT S %CPU %MIN TID+ KOMMAND
1318 root 20 0 396048 268656 2996 D 24,6 1,7 7:41.20 tar
1700 root 20 0 117528 4736 1060 S 3,7 0,0 336:07.59 fprobe-ulog
26867 göran 20 0 3129980 863476 170636 S 2,3 5,5 5:18.18 firefox
2734 root 20 0 0 0 0 S 0,7 0,0 0:00.59 kworker/3:0
2925 göran 20 0 154008 4188 3560 R 0,7 0,0 0:00.08 top
8 root 20 0 0 0 0 S 0,3 0,0 12:40.86 rcu_sched
10 root 20 0 0 0 0 S 0,3 0,0 8:30.88 rcuos/0
937 root 20 0 15624 212 0 S 0,3 0,0 0:15.65 mcstransd
1054 root 20 0 0 0 0 S 0,3 0,0 0:02.43 kworker/0:2
2475 gdm 20 0 905932 47268 33732 S 0,3 0,3 30:16.19 gsd-color
2936 root 20 0 97576 6688 5768 S 0,3 0,0 0:00.01 sshd
8159 eva-bri+ 20 0 154076 4180 3024 S 0,3 0,0 92:59.97 top
18084 root 20 0 233944 19744 10340 S 0,3 0,1 0:57.93 openconnect
18172 eva-bri+ 20 0 158644 6140 4804 S 0,3 0,0 0:54.18 rdesktop
26669 göran 20 0 352672 64388 44296 S 0,3 0,4 1:45.95 Xorg
31629 root 20 0 0 0 0 S 0,3 0,0 0:03.50 kworker/1:0
32451 root 0 -20 0 0 0 S 0,3 0,0 0:03.07 kworker/2:+