Skip to content

Interval expressions should count characters, not UTF-8 bytes #312

Open
@paulmiller

Description

@paulmiller

Try putting "≤" (UTF-8 encoding 0xE2 0x89 0xA4) in a file:

$ echo "≤≤≤" > test.txt
$ xxd test.txt
00000000: e289 a4e2 89a4 e289 a40a                 ..........
$ grep -E '^.{3}$' test.txt
≤≤≤
$ grep -E '^.{9}$' test.txt
$ ack '^.{3}$' test.txt
$ack '^.{9}$' test.txt
≤≤≤

grep counts each "≤" as 1, whereas ack counts each as 3. Thus grep's . matches 3 times, but ack's . matches 9 times.

$ ack --version
ack v3.4.0 (standard build)
Running under Perl v5.32.0 at /usr/bin/perl
$ grep --version
grep (GNU grep) 3.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions