I must have utf-8 characters in url.
For example there is a string that is to be put in url:
"Hayranlık"
I thought to encode it:
try{
selected=URLEncoder.encode(selected,"UTF-8");
}catch(Exception e){
e.printStackTrace();
}
try {
FacesContext.getCurrentInstance().getExternalContext().redirect("http://" + serverUrl +"/myjsfpage.jsf?param=" + selected );
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
I debug it and I see an expected string : Hayranl%C4%B1k%24
In another controller, I must handle it, so I get the url by
HttpServletRequest req = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
String selected = (String)req.getParameter("param");
if(selected ==null){
//show no result message
return;
}
After that i try to decode it, but "before" decoding, my string that I get from url is something like "Hayranlık$".
try{
selected=URLDecoder.decode(selected,"UTF-8");
}catch(Exception e){
e.printStackTrace();
}
Does JSF redirection cause the problem, or is the browser URL handling the problem?