GNU bug report logs - #6934
multibyte: expand miscalculate width of ideographs

Previous Next

Package: coreutils;

Reported by: Zhang Weiwu <zhangweiwu <at> realss.com>

Date: Sat, 28 Aug 2010 01:46:01 UTC

Severity: wishlist

To reply to this bug, email your comments to 6934 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-coreutils <at> gnu.org:
bug#6934; Package coreutils. (Sat, 28 Aug 2010 01:46:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Zhang Weiwu <zhangweiwu <at> realss.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 28 Aug 2010 01:46:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Zhang Weiwu <zhangweiwu <at> realss.com>
To: bug-coreutils <at> gnu.org
Subject: "expand" miscalculate width of ideographs
Date: Sat, 28 Aug 2010 09:36:12 +0800
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.




Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Oct 2018 01:56:02 GMT) Full text and rfc822 format available.

Changed bug title to 'multibyte: expand miscalculate width of ideographs' from '"expand" miscalculate width of ideographs' Request was from Assaf Gordon <assafgordon <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 19 Oct 2018 01:56:02 GMT) Full text and rfc822 format available.

This bug report was last modified 6 years and 248 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.