Closed
Description
Johnny Lim opened SPR-14828 and commented
'+' is valid for a space but with the following code:
String httpUrl = "http://localhost:8080/test/print?value=%EA%B0%80+%EB%82%98";
URI uri = UriComponentsBuilder.fromHttpUrl(httpUrl).build(true).toUri();
System.out.println(uri);
I got the following error:
java.lang.IllegalArgumentException: Invalid character '+' for QUERY_PARAM in "%EA%B0%80+%EB%82%98"
at org.springframework.web.util.HierarchicalUriComponents.verifyUriComponent(HierarchicalUriComponents.java:313)
at org.springframework.web.util.HierarchicalUriComponents.verify(HierarchicalUriComponents.java:281)
at org.springframework.web.util.HierarchicalUriComponents.<init>(HierarchicalUriComponents.java:90)
at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:336)
at learningtest.org.springframework.web.UriComponentBuilderTests.testFromHttpUrlBuildEncoded(UriComponentBuilderTests.java:19)
Affects: 4.3.3
Issue Links:
- UriComponentsBuilder inconsistent encode/decode query params behavior [SPR-16002] #20551 UriComponentsBuilder inconsistent encode/decode query params behavior ("is duplicated by")
- UriComponents.Type.QUERY_PARAM does not match spec [SPR-10172] #14805 UriComponents.Type.QUERY_PARAM does not match spec ("is duplicated by")
- UriComponentsBuilder does not encode "+" properly [SPR-16718] #21259 UriComponentsBuilder does not encode "+" properly
- Not encoding '+' in URLs anymore breaks backwards compatibility with apps running on spring 4 [SPR-17474] #22006 Not encoding '+' in URLs anymore breaks backwards compatibility with apps running on spring 4
- Encoding of URI Variables on RestTemplate [SPR-16202] #20750 Encoding of URI Variables on RestTemplate
- UriUtils query param "safe" encoding mode (%-encode sub-delims) [SPR-16934] #21473 UriUtils query param "safe" encoding mode (%-encode sub-delims)
Referenced from: commits f2e293a
1 votes, 6 watchers