1

I have a REST API

@RequestMapping(value = "/Save", method = RequestMethod.POST, 
            consumes = {"application/json;charset=ISO-8859-1" }, 
            produces = {"application/json;charset=ISO-8859-1" })    
public SaveResponse save(@RequestBody SaveRequest request) {
        //some codes
    }
}

My request contains the following lines

{
  :
  :
      "mailingAddress": {
      "addressLine1": "Carrera 36E N°",
      "addressLine2": "Medellín, Antioquia",
      "country": "COL"
    }
  :

And I received a 400 Bad Request

HTTP/1.1 400 Bad Request
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Date: Wed, 16 Jun 2021 12:26:37 GMT
Pragma: no-cache
Content-Length: 0
Expires: 0
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-RBT-Optimized-By: CANA014IJT (RiOS 6.1.1a #11) SC

And when I removed the characters "°" and "í" from the request, then the request can go through with no error. What is my problem?

Thank you.

Tony C
  • 29
  • 2

1 Answers1

0

You can try changing the character set from ISO-8859-1 to UTF-8, as the former does not support as wide an array of character mappings (What is the difference between UTF-8 and ISO-8859-1?).

Woodchuck
  • 3,869
  • 2
  • 39
  • 70