You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "zhangbingyan (GitHub)" <gi...@apache.org> on 2018/11/03 14:01:04 UTC

[GitHub] [incubator-dubbo] zhangbingyan opened issue #2732: dubbo使用rest协议,集成tomcat时,postman传参中文乱码

版本:2.6.1
Java version: 1.8
基于dubbo rest协议开发的api接口,传参中文乱码

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2732 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] lexburner commented on issue #2732: dubbo使用rest协议,集成tomcat时,postman传参中文乱码

Posted by "lexburner (GitHub)" <gi...@apache.org>.
I need your interface definition to find out the problem And make sure `@Produces({"application/json; charset=UTF-8", "text/xml; charset=UTF-8"})` is set to your interface.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2732 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] zhangbingyan closed issue #2732: dubbo使用rest协议,集成tomcat时,postman传参中文乱码

Posted by "zhangbingyan (GitHub)" <gi...@apache.org>.
[ issue closed by zhangbingyan ]

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2732 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] zhangbingyan commented on issue #2732: dubbo使用rest协议,集成tomcat时,postman传参中文乱码

Posted by "zhangbingyan (GitHub)" <gi...@apache.org>.
> I need your interface definition to find out the problem And make sure `@Produces({"application/json; charset=UTF-8", "text/xml; charset=UTF-8"})` is set to your interface.

是的,我确定接口上有注释@@Produces({"application/json; charset=UTF-8", "text/xml; charset=UTF-8"}),但是依然有乱码,最后我发现参数解码的时候使用的是默认的ISO-8859-1编码(见org.apache.tomcat.util.http.Parameters),需要设置request的编码方式,实现ContainerRequestFilter的filter方法,在RpcContext上下文中设置HttpServletRequest的CharacterEncoding,建议这部分写到源码中!

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2732 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] lexburner commented on issue #2732: dubbo使用rest协议,集成tomcat时,postman传参中文乱码

Posted by "lexburner (GitHub)" <gi...@apache.org>.
I need your interface definition to find out the problem.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/2732 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org