character encoding - UTF-8 decoding problems in Java & Tomcat7 -
i'm sending ajax request server, param value encoded in "escape(...)" function.
the tomcat server (7.0.42) configured s.t. receiving connector has uriencoding="utf-8", in web.xml have configured setcharacterencodingfilter follows:
<filter> <filter-name>charencode</filter-name> <filter-class> org.apache.catalina.filters.setcharacterencodingfilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> </filter> <filter-mapping> <filter-name>charencode</filter-name> <url-pattern>*</url-pattern> </filter-mapping> , , additionally have created filter encode response utf-8:
@override public void dofilter(servletrequest arg0, servletresponse arg1, filterchain arg2) throws ioexception, servletexception { arg1.setcharacterencoding("utf-8"); arg2.dofilter(arg0, arg1); } there no issue parsing params come latin charset, when tried russian, request.getparameter(..) returns null. additionally, in logs (suspect it's coming setcharacterencodingfilter):
info: character decoding failed. parameter [usersaid] value [%u044b%u0432%u0430%u044b%u0432%u0430%u044b%u0432%u044b%u0432%u0430%u044b%u0432%u0430%21] has been ignored. note name , value quoted here may corrupted due failed decoding. use debug level logging see original, non-corrupted values. and there no debug-level messages follow (my logger set right believe..)
could please advise? happy answer questions!
many thanks, victor.
that string doesn't decode. nothing application server. try these tools see self:
http://www.albionresearch.com/misc/urlencode.php http://meyerweb.com/eric/tools/dencoder/
so, error looks might client side. make sure set encoding correctly when urlencoding. using else utf-8, should use.
here's thread on correctly encoding unicode characters: what proper way url encode unicode characters?
Comments
Post a Comment