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

Support UTF-8 and ? #12

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Support UTF-8 and ? #12

wants to merge 3 commits into from

Conversation

figsoda
Copy link

@figsoda figsoda commented Nov 16, 2024

The two features are bundled together because I couldn't find a way to test UTF-8, since valid multibyte UTF-8 characters cannot contain ASCII characters like * and /. Invalid multibyte UTF-8 characters are allowed on ext4 Linux, but Nix seems to normalize them into valid UTF-8 and gets rid of the invalid * and / bytes in the process.

Added a fix for patterns like \*, since * is a valid character in file names, at least on ext4 Linux. I made sequences like \t match the character t instead of a tab, but didn't add any tests for it, since I'm not sure if this is a behavior we want to keep.

The UTF-8 feature is implemented using https://github.com/figsoda/utf8. The implementation might be a little inefficient because it converts back and forth between strings and lists of characters using concatStrings and utf8.chars, but hopefully shouldn't be a big deal because of how short glob pattern usually are. I went with this route because otherwise the diff might be a bit hard to review.

closes #5
closes #6

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.

Add support for ? meta character Add support for UTF8
1 participant