Uploaded image for project: 'HttpComponents HttpCore'
  1. HttpComponents HttpCore
  2. HTTPCORE-714

URIBuilder incorrectly parses path with special characters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Not A Problem
    • 5.1.2
    • None
    • HttpCore
    • None

    Description

      Code sample:

      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
      }

      In the last example, URIBuilder seems to have turned "/🙈" into "/=H".

      Attachments

        Activity

          People

            Unassigned Unassigned
            slisaasquatch Siqi Li
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: