Wicket
  1. Wicket
  2. WICKET-1413

RequestUtils.toAbsolutePath() has a bug regarding to UTF-8 encoded page parameter.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.3.0-final
    • Fix Version/s: 1.3.5
    • Component/s: wicket
    • Labels:
      None
    • Environment:
      Wicket 1.3.0 (maybe 1.3.1 too)

      Description

      It seems RequestUtils.toAbsolutePath() has a bug regarding to UTF-8 encoded page parameter :

      I have a bookmarkable page , which takes a UTF-8 encoded parameter "place" :

      private PageParameters pps;
      pps.put("place", URLEncoder.encode(place , "UTF-8"));

      In this Page , I have a TextField that prints the URL for this page (for users to copy) :
      String url = RequestUtils.toAbsolutePath("");
      TextField resultUrl;
      resultUrl = new TextField("resultUrl");
      resultUrl.setModel(new Model( url ));
      resultUrl.setEscapeModelStrings(false);
      resultUrl.setOutputMarkupId(true);
      add(resultUrl);

      For example , "台北市" (Chinese word : "Taipei" ) is encoded correctly to :
      place/%25E5%258F%25B0%25E5%258C%2597%25E5%25B8%2582
      And it is correctly shown in the browser URL bar.

      But it is incorrectly shown in the textfield :
      place/%E5%8F%B0%E5%8C%97%E5%B8%82

        Activity

        Hide
        Johan Compagner added a comment -

        as far as i can see that is what the web container gives us or the servlet spec/url decoding

        because if i just test it with nice url example

        http://www.wicketstuff.org:8090/wicket13/niceurl/my/mounted/package/Page5/param1/-622228254/param2/台北市/

        then this is what i get from tomcat:

        my/mounted/package/Page5/param1/-87084664/param2/%E5%8F%B0%E5%8C%97%E5%B8%82/

        and the end result is again in the page : 台北市

        so the conversion from 台北市 to %E5%8F%B0%E5%8C%97%E5%B8%82 and back to 台北市 seems to be correct.

        Show
        Johan Compagner added a comment - as far as i can see that is what the web container gives us or the servlet spec/url decoding because if i just test it with nice url example http://www.wicketstuff.org:8090/wicket13/niceurl/my/mounted/package/Page5/param1/-622228254/param2/ 台北市/ then this is what i get from tomcat: my/mounted/package/Page5/param1/-87084664/param2/%E5%8F%B0%E5%8C%97%E5%B8%82/ and the end result is again in the page : 台北市 so the conversion from 台北市 to %E5%8F%B0%E5%8C%97%E5%B8%82 and back to 台北市 seems to be correct.

          People

          • Assignee:
            Johan Compagner
            Reporter:
            smallufo
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development