|
| 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.
| [Prev in Thread] | Current Thread | [Next in Thread] |