bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#6934: "expand" miscalculate width of ideographs


From: Zhang Weiwu
Subject: bug#6934: "expand" miscalculate width of ideographs
Date: Sat, 28 Aug 2010 09:36:12 +0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100423 Lightning/1.0b1 Mnenhy/0.8.2 Thunderbird/3.0.4

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

[Prev in Thread] Current Thread [Next in Thread]