Open
Conversation
Ensude we aren't using HTML::Entities for consistency. Correct order of got vs expected. Indent pod template to avoid editor warnings on invalid pod. Use a consistent name suffix for each test.
URL fragments are percent encoded. Percent encoding is a byte encoding, so its input must be encoded as UTF-8. Even for documents using a different encoding in their source, such as ISO-8859-1, browsers expect the URL fragments to be UTF-8 encoded. Since percent encodings only ever deal with 0 to 255, we can precalculate a mapping of characters to encoded form. Encode the URL as UTF-8, then use the mapping to percent encode the result. No fallback is provided if utf8::encode is not available. If you try to use this with non-ascii characters on perl 5.6, you get to keep both pieces.
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.
URL fragments are percent encoded. Percent encoding is a byte encoding, so its input must be encoded as UTF-8. Even for documents using a different encoding in their source, such as ISO-8859-1, browsers expect the URL fragments to be UTF-8 encoded.
Since percent encodings only ever deal with 0 to 255, we can precalculate a mapping of characters to encoded form. Encode the URL as UTF-8, then use the mapping to percent encode the result.
No fallback is provided if utf8::encode is not available. If you try to use this with non-ascii characters on perl 5.6, you get to keep both pieces.