I have a problem with sending umlauts to Spring API. I want to post a following JSON:
{
"username": "testümlaut",
"firstName": "test",
"lastName": "Test"
}
for this I have a following method start:
@RequestMapping(value="/User", method=RequestMethod.POST,
produces={"application/json ; charset=utf-8"}
)
@ResponseStatus(HttpStatus.CREATED)
public @ResponseBody User postUser(@RequestBody User user) {
User user = userDao.addUser(user);
return user;
}
As you can see I do have a line:
produces={"application/json ; charset=utf-8"}
but it does not help. I get always an exception (0xfc is ü):
Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: Could not read document: Invalid UTF-8 start byte 0xfc
at [Source: java.io.PushbackInputStream@721e5ed1; line: 2, column: 19] (through reference chain: de.escosautomation.restserver.model.user.UserClone["username"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Invalid UTF-8 start byte 0xfc
at [Source: java.io.PushbackInputStream@721e5ed1; line: 2, column: 19] (through reference chain: de.escosautomation.restserver.model.user.UserClone["username"])
What can I also add to make it work?
Thanx.