[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#7915: Possible off-by-1 in wc
From: |
Eric Blake |
Subject: |
bug#7915: Possible off-by-1 in wc |
Date: |
Tue, 25 Jan 2011 18:59:46 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101209 Fedora/3.1.7-0.35.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.7 |
On 01/25/2011 06:18 PM, Sune Mølgaard wrote:
> address@hidden:~$ echo Å|wc -m
> 2
> address@hidden:~$ echo Å|wc -c
> 3
> address@hidden:~$
>
> Expected: 1 and 2 respectively.
Thanks for the report. However, this is not a bug - echo is outputting
a newline (which is a second character, and third byte given the
encoding of your chosen character).
To see the difference, try:
$ echo Å | od -tx1z
0000000 c3 85 0a >...<
0000003
$ printf Å | od -tx1z
0000000 c3 85 >..<
0000002
--
Eric Blake address@hidden +1-801-349-2682
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature