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

getopts only works with UTF-8 strings, cannot process non-UTF-8 filenames #97

Open
samuela opened this issue Jun 24, 2020 · 3 comments
Open

Comments

@samuela
Copy link

samuela commented Jun 24, 2020

See samuela/rustybox#32 (comment). This has been a factor in https://github.com/uutils/coreutils migrating from getopts to clap.

@joshuarli
Copy link

Same issue in a similar project that was just brought to my attention: google/argh#33

FWIW @samuela, that looks like it's gaining a bit of traction.

@KodrAus
Copy link
Contributor

KodrAus commented Dec 21, 2020

If it's possible to fix this up without breakage then we'd happily accept a patch to support non-UTF8 args. Otherwise I think we'll probably have to accept the UTF8 requirement as a limitation of getopts.

@HeroicKatora
Copy link

HeroicKatora commented Mar 2, 2021

It might be possible but the field Matches::free has type Vec<String> so any additional path argument can't be collected into it without being valid UTF8. It would be necessary to add an additional field with type Vec<OsString> to avoid interface breakage, this is possible as there are private fields, and some opt-in method to populate the field instead of free.

I can provide a patch but want to know if this direction might be potentially accepted before working on it.

mqudsi added a commit to neosmart/rewrite that referenced this issue Mar 2, 2021
It's crusty and old, and was causing problems preventing non-Unicode
paths from being used as destinations.

See rust-lang/getopts#97

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

No branches or pull requests

4 participants