Skip to content

Space characters are encoded as '+' #3124

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

Merged
merged 2 commits into from
Sep 6, 2019
Merged

Conversation

RichTeaTime
Copy link

Existing description implies that the specified character classes are the only exceptions to hexadecimal encoding.
I'm trying to match Javascript 'encodeURIComponent' behavior, and expected WebUtility.UrlEncode to provide this.
However, as spaces are a further exception, this method produces results that are functionally identical to that produced by HttpUtility.UrlEncode.

Might also be useful to mention Uri.EscapeDataString and AntiXss.UrlEncode as well here, as these are now preferred options when looking to encode URIs in a transparent, reversible manner.

Summary

Describe your changes here.

Fixes #Issue_Number (if available)

Existing description implies that the specified character classes are the only exceptions to hexadecimal encoding.
I'm trying to match Javascript 'encodeURIComponent' behavior, and expected WebUtility.UrlEncode to provide this. 
However, as spaces are a further exception, this method produces results that are functionally identical to that produced by HttpUtility.UrlEncode.

Might also be useful to mention Uri.EscapeDataString and AntiXss.UrlEncode as well here, as these are now preferred options when looking to encode URIs in a transparent, reversible manner.
@RichTeaTime RichTeaTime requested a review from karelz as a code owner September 5, 2019 12:39
@mairaw mairaw requested a review from davidsh September 5, 2019 18:35
@mairaw mairaw added the ✨ 1st-time dotnet-api-docs contributor! Indicates PRs from new contributors to the dotnet-api-docs repository label Sep 5, 2019
@mairaw mairaw added this to the September 2019 milestone Sep 5, 2019
@mairaw
Copy link
Contributor

mairaw commented Sep 5, 2019

@davidsh can you please review this change?

Copy link
Contributor

@mairaw mairaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @davidsh for your help! Applying your comment as a suggestion so @RichTeaTime can easily apply the fix.

As requested, removed reference to HttpUtility.
Thanks @davidsh and @mairaw

Co-Authored-By: Maira Wenzel <mairaw@microsoft.com>
Copy link
Contributor

@mairaw mairaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making the change. I’ll merge your PR now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ 1st-time dotnet-api-docs contributor! Indicates PRs from new contributors to the dotnet-api-docs repository
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants