Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes the handling of filesystem entries with invalid UTF-8 names (#295). It is an adapted version of #309 by @alexmaco (thank you for your initial work!).
Invalid UTF-8 filenames are properly passed to child-processes when using
--exec
,--exec-batch
or--list-details
:There are a few things to note:
fd -x echo
will print the actual invalid UTF-8 sequence, as expectedfd -x echo
, you might still see "test_�invalid.txt" if your terminal emulator wants to save you from scrambled output.fd -l
properly passes the filename tols
fd … -x rm
properly passes the filename torm
If not using
-x
or-X
, we still make sure to print the "invalid UTF-8 sequence" character "�". However, if we pipe the output to another program (likexargs
), we pass the filenames as is (on Unix):fixes #295