[
https://issues.apache.org/jira/browse/HTTPCORE-714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17544042#comment-17544042
]
Michael Osipov commented on HTTPCORE-714:
-----------------------------------------
Forget {{java.net.URI}}, it is broken. Your input is broken. It has to be
URI-encoded.
> URIBuilder incorrectly parses path with special characters
> ----------------------------------------------------------
>
> Key: HTTPCORE-714
> URL: https://issues.apache.org/jira/browse/HTTPCORE-714
> Project: HttpComponents HttpCore
> Issue Type: Bug
> Components: HttpCore
> Affects Versions: 5.1.2
> Reporter: Siqi Li
> Priority: Minor
>
> Code sample:
> {code:java}
> public static void main(String[] args) throws Exception {
> System.out.println(new java.net.URI("http://example.com/🙈").getPath()); //
> Prints /🙈
> System.out.println(new URIBuilder("http://example.com/" +
> java.net.URLEncoder.encode("🙈", "UTF-8")).getPath()); // Prints /🙈
> System.out.println(new
> URIBuilder().setPathSegments(Collections.singletonList("🙈")).getPath()); //
> Prints /🙈
> System.out.println(new URIBuilder().setPath("/🙈").getPath()); // Prints /🙈
> System.out.println(new URIBuilder("http://example.com/🙈").getPath()); //
> Prints /=H
> }{code}
> In the last example, URIBuilder seems to have turned "/🙈" into "/=H".
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]