In a hexdump, printf seems to add a 3 characters for the thousands
separator:

#!/bin/sh
for l in de_DE en_US nb_NO nn_NO ; do
   echo "LC_NUMERIC=$l.UTF-8"
   for n in 1 100 1000 10000 100000 1000000 10000000 ; do     
      LC_NUMERIC=$l.UTF-8 /usr/bin/printf "<%'8d>" $n | hexdump -C
   done
done

Output:

LC_NUMERIC=nb_NO.UTF-8
00000000  3c 20 20 20 20 20 20 20  31 3e                    |<       1>|
0000000a
00000000  3c 20 20 20 20 20 31 30  30 3e                    |<     100>|
0000000a
00000000  3c 20 31 e2 80 af 30 30  30 3e                    |< 1...000>|
0000000a
00000000  3c 31 30 e2 80 af 30 30  30 3e                    |<10...000>|
0000000a
00000000  3c 31 30 30 e2 80 af 30  30 30 3e                 |<100...000>|
0000000b
00000000  3c 31 e2 80 af 30 30 30  e2 80 af 30 30 30 3e     |<1...000...000>|
0000000f
00000000  3c 31 30 e2 80 af 30 30  30 e2 80 af 30 30 30 3e  |<10...000...000>|
00000010
LC_NUMERIC=nn_NO.UTF-8
00000000  3c 20 20 20 20 20 20 20  31 3e                    |<       1>|
0000000a
00000000  3c 20 20 20 20 20 31 30  30 3e                    |<     100>|
0000000a
00000000  3c 20 31 e2 80 af 30 30  30 3e                    |< 1...000>|
0000000a
00000000  3c 31 30 e2 80 af 30 30  30 3e                    |<10...000>|
0000000a
00000000  3c 31 30 30 e2 80 af 30  30 30 3e                 |<100...000>|
0000000b
00000000  3c 31 e2 80 af 30 30 30  e2 80 af 30 30 30 3e     |<1...000...000>|
0000000f
00000000  3c 31 30 e2 80 af 30 30  30 e2 80 af 30 30 30 3e  |<10...000...000>|
00000010

However, both in Konsole as well as in XTerm, the issue occurs. So, the
bytes "0xe2 0x80 0xaf" inserted by printf for the thousands separator
seem to be incorrect? "0xe2 0x80 0xaf" is UTF-8 NARROW NO-BREAK SPACE ->
https://www.fileformat.info/info/ .unicode/char/202f/index.htm .

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2058775

Title:
  coreutils: printf formatting bug for nb_NO and nn_NO locales

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/2058775/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to