GNU bug report logs - #52252
Escape sequences treated as visible characters, long characters split

Previous Next

Package: coreutils;

Reported by: Fabian Röling <fabianroeling <at> googlemail.com>

Date: Thu, 2 Dec 2021 23:59:02 UTC

Severity: normal

Full log


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

From: Fabian Röling <fabianroeling <at> googlemail.com>
To: bug-coreutils <at> gnu.org
Subject: Escape sequences treated as visible characters, long characters split
Date: Fri, 3 Dec 2021 00:53:40 +0100
[Message part 1 (text/plain, inline)]
"fold" includes the character '\e' and each of the following characters
that are used to format text as if they were all visible.
Example:
echo "a\e[3mb\e[0mc" | fold -w1
Result:
a




*b*




c
It still formats correctly, it just breaks too early.
Special characters can even be broken up.
Example:
echo "君の名は" | fold -w1
Result:
�
�
�
�
�
�
�
�
�
�
�
�
In case this appears invisible or otherwise different: It's 12 lines with
one "tofu"/U+FFFD/replacement character each.
I would maybe expect issues like this when the "-b" option is given, since
that counts bytes, but it happens even without it.

While trying to work around this, I noticed a similar issue with "wc":
echo -e "\e[3ma\e[0m" | wc -cm
     10      10
I have not investigated this further so far.
[Message part 2 (text/html, inline)]

This bug report was last modified 3 years and 196 days ago.

Previous Next


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