Santosh Hegde Santosh Hegde - 4 months ago 11x
Java Question

How to send Japanese text to backend Java code via http get?

I want send を伴う出力となって to backend java code via http get request.
My get call url is http://localhost:8080/test/getID?id=%E3%82%92%E4%BC%B4%E3%81%86%E5%87%BA%E5%8A%9B%E3%81%A8%E3%81%AA%E3%81%A3%E3%81%A6

Java code:

@RequestMapping(value = "/getCaseId")
public ModelAndView showCaseId(HttpServletRequest request, HttpServletResponse response) throws UnsupportedEncodingException {
String msg = request.getParameter("id");
return new ModelAndView("showID", "idList", null);

Above piece of code prints URL:ãä¼´ãåºåã¨ãªã£ã¦.
So what's change i need to do get the exact Japanese text what i have passed from front end.


Try changing your msg line to:

String msg = new String(

If that will work it means that your application server (Tomcat? jetty?) is not configured correctly to handle UTF-8 in URLs.