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 , "台北市" (meaning 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 incorrect in the textfield :
place/%E5%8F%B0%E5%8C%97%E5%B8%82
Is it a bug ? If not , how to solve it ?