mardi 14 avril 2015

passing non-English character parameters in spring MVC

I have a problem passing my parameters in springMVC.



@RequestMapping(value = "/", method = RequestMethod.POST)
public String homePost(Model model, HttpServletRequest request) {
StringBuilder redirect = new StringBuilder();
String para = request.getParameter("keyword");

redirect.append("redirect:/search?" + "cat=0&job="+ para);
logger.info("Page called: SEARCH; Called parameter: KEYWORD: " + redirect.toString());

return redirect.toString();
}


In my console, I can see:



Page called: SEARCH; Called parameter: KEYWORD: redirect:/search?cat=0&job=lol лол lol



But my URL is



http://localhost:8088/search?cat=0&job=lol%20%20%20%20%20lol



I set my all encoding in "UTF-8" and I am trying to search from list using Cyrillic but it keeps converting Cyrillic letters into empty spaces. I can search using Latin letters. If I write in the URL manually using Cyrillic letters, I can also search. In the console, it also shows



bind => [%lol lol%]



Thank you.


P.S Even if I did not use StringBuilder, I have the same problem.


Aucun commentaire:

Enregistrer un commentaire