Repository navigation
Conversation
On Unix, a path may contain bytes that are not valid UTF-8. These were copied verbatim into the hyperlink URI, which makes for an invalid URI and puts raw bytes outside 32-126 into the OSC 8 escape sequence. Non-ASCII characters in valid UTF-8 are still left unencoded, as before, since encoding them breaks file:// URLs on Windows. Bytes that are not part of valid UTF-8 are now percent-encoded. Fixes BurntSushi#3526
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
on unix a path can contain bytes that aren't valid UTF-8.
HyperlinkPath::encodecopied every byte >= 128 as is, so the URI wasn't valid and raw bytes ended up inside the OSC 8 sequence.bytes that aren't part of valid UTF-8 are now percent-encoded (the loop goes over
utf8_chunks()). valid non-ascii is still left unencoded like before, since encoding it breaks file:// URLs on windows (as the doc comment onencodesays). nothing changes on windows, the path is always valid UTF-8 there.added
encode_invalid_utf8and a CHANGELOG entry. grep-printer tests pass.Fixes #3526