Spring - wrong encoding POST request with x-www-form-urlencoded

Bizman345 :

I'm trying build an app that takes a POST(with x-www-form-urlencoded header) with one parameter. This is my POST method code:

@RequestMapping(value = "/translate", method = RequestMethod.POST)
public String getTranslate(@RequestParam("text") String text) {
     //................      
}

When i do POST request by Postman with data "Let’s measure"(image below) in method getTranslate text value is "Letâs measure". What am I doing wrong?

Image Attachment

KhAn SaAb :

I guess you have missed to add encoding in the header of your request- just add content-type & encoding and try:

Content-Type:application/x-www-form-urlencoded;charset=UTF-8

Postman screenshot

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=151527&siteId=1