Skip to content
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

HierarchicalUriComponents.encodeUriComponent() method can not encode Pchar [SPR-17621] #22153

spring-projects-issues opened this issue Dec 22, 2018 · 2 comments
in: web status: declined


Copy link

@spring-projects-issues spring-projects-issues commented Dec 22, 2018

sunbufu opened SPR-17621 and commented

Hi guy,

I have a question about HierarchicalUriComponents.encodeUriComponent() method. I think it should encode all special char in url query param, Actually, It can not encode many special char. For example + - ! $ ... in url query param. and my email is [|] . 

Affects: 5.0.6

Reference URL:


Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 23, 2018

Brian Clozel commented

Did you take a loot at the RFC that's referenced from the implementation here?

The RFC 3986 states that the following characters are allowed in a query string (see the appendix A in the ABNF):

query         = *( pchar / "/" / "?" )
pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
pct-encoded   = "%" HEXDIG HEXDIG
sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
                 / "*" / "+" / "," / ";" / "="

This means that sub-delimiters are allowed in query strings and do not need to be percent encoded (that includes +, $).

Now I understand that some legal characters might still have a special meaning. We've applied some changes to be more consistent with the encoding of URLs (see #21399), and I think you're ultimately after what was addressed in #21577 (see the dedicated section in the reference documentation).


Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Dec 23, 2018

sunbufu commented

Got it. Thanks very much.

@spring-projects-issues spring-projects-issues added type: bug status: declined in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues removed the type: bug label Jan 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: web status: declined
None yet

No branches or pull requests

2 participants