#630432 fold: no multibyte character support

Package:
coreutils
Source:
coreutils
Description:
GNU core utilities
Submitter:
Connor Lane Smith
Date:
2011-07-10 22:21:03 UTC
Severity:
normal
#630432#5
Date:
2011-06-14 01:39:40 UTC
From:
To:
According to POSIX the fold utility is intended to fold characters, with
the '-b' flag used to fold bytes instead. However, GNU fold will always
fold bytes. Compare:

  $ echo '$$$$$$$$' | fold -w 4
  $ echo '££££££££' | fold -w 4

The former will produce 2 lines, while the latter will produce 4, since
the UTF-8 character '£' consists of 2 bytes. The behaviour is identical
when the '-b' flag is used. FreeBSD's fold treats multibyte characters
correctly.