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

Properly escape non-utf8 file names #463

Open
clarcharr opened this Issue Jan 8, 2019 · 0 comments

Comments

1 participant
@clarcharr
Copy link
Contributor

clarcharr commented Jan 8, 2019

Right now, anything that isn't valid UTF-8 gets its invalid characters replaced with replacement characters. IMHO the way things should be done is to have two ways of displaying things:

  1. default (non-printable escaped as \u{NNNN})
  2. default-quoted (same as above, surrounded in " quotes with " escaped)
  3. shell-quoted (surrounded in ' quotes with non-printable ASCII escaped as \xNN and ' escaped as '\'')

If a path is invalid UTF-8, it will be shell-quoted always. If it contains whitespace, then it will be quoted. Otherwise, it will not be quoted.

There should be an --nonascii-quote (bikeshed) flag as well which will always shell-quote names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment