spring - Receive wrong representation of non-unicode characters in request to controller ("Ðо" instead of "Сыр") -
here controller:
@requestmapping(value = "/item/products", method = requestmethod.get) @responsebody public productdto[] getproducts(pageable pageable, @requestparam(value = "searchdto", required = false) string serializeddto) throws ioexception {
i send request:
...item/products?page=0&size=10&sort=status,asc&sort=id,asc&searchdto={"name":"Сыр"}
"Сыр" - cyrillic
and in controller receive this:
serializeddto = {"name":"Ðо"}
instead of this:
serializeddto = {"name":"Сыр"}
problem in encoding, have tried lot of things didn't work. i'm doing wrong? if need more code/materials provide it.
if using tomcat consider default ignoring url parameters encoding. maven plugin add next configuration:
<plugin> <groupid>org.apache.tomcat.maven</groupid> <artifactid>tomcat7-maven-plugin</artifactid> <version>2.2</version> <configuration> <uriencoding>utf-8</uriencoding> </configuration> </plugin>
or configure tomcat http connector
Comments
Post a Comment