Skip to content

Fails on files with UTF8-BOM #113

@Chronial

Description

@Chronial

Steps to reproduce:

echo -e '\xEF\xBB\xBFHi there' > myfile.txt
rgr Hi
(replace with anything)

Result:

thread 'main' panicked at /home/christian/.cargo/registry/src/index.crates.io-6f17d22bba15001f/repgrep-0.16.0/src/replace.rs:84:45:
byte index 2 is not a char boundary; it is inside '\u{feff}' (bytes 0..3) of `Hi there
`
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
fish: Job 1, 'rgr hi' terminated by signal SIGABRT (Abort)

Notes:

Trying to replace there with anything does not crash, but fails with

An error occurred during replacement: Failed to perform all replacements, see log

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions