On Sun, Feb 12, 2017 at 10:21:11PM -0800, Eric Pruitt wrote:
> On Sun, Feb 12, 2017 at 09:21:37PM +0100, Walter Alejandro Iglesias wrote:
> > After investigating a bit I realized that what I called utf8 space is a
> > 'nobreakspace' so it's ok fmt to replace them for ascii ones. I made a
> > stupid question. Sorry!
>
> If that's the behavior you see, I think _that_ is a bug: the reason
> non-breaking spaces exist is so programs do not separate words at that
> character (https://en.wikipedia.org/wiki/Non-breaking_space). GNU fmt
> respects non-breaking spaces and handles them accordingly:
>
> ~$ fmt --version | head -n1
> fmt (GNU coreutils) 8.25
> ~$ printf "XXXX XXXXXXXXXXXXXXX\u00a0XXX XXX" | fmt -w 20
> XXXX
> XXXXXXXXXXXXXXXÂ XXX
> XXX
> ~$ printf "XXXX XXXXXXXXXXXXXXX XXX XXX" | fmt -w 20
> XXXX
> XXXXXXXXXXXXXXX
> XXX XXX
>
> Unfortunately I do not have access to an OpenBSD machine to verify
> whether or not its fmt does the correct thing.
>
> Eric
OpenBSD 6.0-current (GENERIC.MP) #0: Sat Feb 11 09:48:19 CET 2017
[email protected]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
$ printf "XXXX XXXXXXXXXXXXXXX\u00a0XXX XXX" | LC_CTYPE=en_US.UTF-8 fmt -w 20
XXXX XXXXXXXXXXXXXXX
XXX XXX
$ printf "XXXX XXXXXXXXXXXXXXX XXX XXX" | LC_CTYPE=en_US.UTF-8 fmt -w 20
XXXX XXXXXXXXXXXXXXX
XXX XXX
$ printf "XXXX XXXXXXXXXXXXXXX\u00a0XXX XXX" | LC_CTYPE=C fmt -w 20
XXXX
XXXXXXXXXXXXXXXÂ XXX
XXX
$ printf "XXXX XXXXXXXXXXXXXXX XXX XXX" | LC_CTYPE=C fmt -w 20
XXXX XXXXXXXXXXXXXXX
XXX XXX
Thanks Eric.