bug-coreutils
[Top][All Lists]
Advanced

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

bug#52252: Escape sequences treated as visible characters, long characte


From: Fabian Röling
Subject: bug#52252: Escape sequences treated as visible characters, long characters split
Date: Fri, 3 Dec 2021 00:53:40 +0100

"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.


reply via email to

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