Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable jaq to deal with non-UTF-8 file paths (on the command-line). #234

Merged
merged 6 commits into from
Nov 12, 2024

Conversation

01mf02
Copy link
Owner

@01mf02 01mf02 commented Nov 12, 2024

This PR allows providing paths on the command-line that are not UTF-8, see #231.

To see this in action:

mkdir foo
echo bar > foo/$(iconv -f UTF-8 -t UTF-16 <(echo 'abc#$%%^'))
cargo run -- -n --rawfile a foo/* '$a'

This should yield "bar\n". Before this PR, this would fail with:

error: Invalid UTF-8 was detected in one or more arguments

@01mf02 01mf02 merged commit 0a3ad13 into main Nov 12, 2024
1 check passed
@01mf02 01mf02 deleted the non-utf8-paths branch November 12, 2024 16:58
@thaliaarchi
Copy link

You’ve got an unwrap in the case the filter isn’t valid UTF-8, by the way, which bypasses your error propagation.

@01mf02
Copy link
Owner Author

01mf02 commented Nov 13, 2024

You’ve got an unwrap in the case the filter isn’t valid UTF-8, by the way, which bypasses your error propagation.

You're right, I got a bit lazy. e75ecbd addresses this now. Thanks for bringing it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants