printf doesn't work properly for non-ASCII
Hi!
I decided to try how partman works with localised strings and observed
that some of the strings almost overlap on the screen. Investigation
showed that this was caused by printf.
In several places in the code of partman are used commands like
printf "(%5s)\n" $var
The problem is that printf considers the length of the strings in
bytes as length in symbols which is not true for UTF-8. For example
if var='пя' (two Cyrillic letters) then the quoted printf command will
output "( пя)" instead of "( пя)". For Asian languages the
situation can be even worse because there 3 or 4 bytes represent only
one character.
All versions of printf I tested are broken -- the internal printf
command in bash, /usr/bin/printf and busybox. Does someone know how
this can be fixed?
Anton Zinoviev
Reply to: