[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wc: expand help of '-L' (and a question)
From: |
Assaf Gordon |
Subject: |
Re: wc: expand help of '-L' (and a question) |
Date: |
Fri, 24 Apr 2015 22:57:44 -0400 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
Answering myself:
On 04/24/2015 10:38 PM, Assaf Gordon wrote:
I seem to get unexpected result with '-L' when forcing C locale.
<...>
# using C locale, characters=bytes=3,
# but longest line is 0 ?
$ printf "\xe2\x99\xa5" | LC_ALL=C wc -cmL
3 3 0
This could be because of wc.c line 492, where "isprint" is called on each byte
(e.g. isprint('\xe2') is false),
and so these characters are not counted at all?
Under C locale these characters are not printable, so not counted.
So technically, '-L' prints longest line using only printable characters under
the locale, which is different then the 'characters/-m' definition.
meaning it's quite tricky to count longest line of bytes in a file.
perhaps my previous patch should be reworded...