reproduce:

$ printf "1This is a test\t3This is test too\t5And more 
test\n2测试一是这样\t4测试二如此\t6测试三,嗯。\n" | expand -t 12
1This is a test         3This is test too       5And more test
2测试一是这样     4测试二如此        6测试三,嗯。

expected:
$ printf "1This is a test\t3This is test too\t5And more 
test\n2测试一是这样\t4测试二如此\t6测试三,嗯。\n" | expand -t 12
1This is a test         3This is test too       5And more test
2测试一是这样           4测试二如此             6测试三,嗯。

Note that your email software must be able to show ideograph correctly in order 
to see the problem. 

Note that other coreutils do not suffer from this problem. Take ls for example:

$ touch "1This is a test" "2测试一是这样" "3This is test too" "4测试二如此" "5And more 
test" "6测试三,嗯。"
2$ ls
1This is a test  3This is test too  5And more test
2测试一是这样    4测试二如此        6测试三,嗯。

So you see ls(1) output have ideograph width correctly calculated.

So I can guess that simply taking the width calculation routine of ls(1)
and use it in expand would solve the problem.



Reply via email to