且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在servlet中读取utf-8值

更新时间:2023-11-27 21:35:16

如果你正在使用tomcat,你可以试试他们的utf8编码过滤器(当然把它添加到你的web.xml)。他们的过滤器名为org.apache.catalina.filters.SetCharacterEncodingFilter,或者如果您不想依赖第三方,那么您可以查看他们的源代码并编写自己的源代码,这不是很复杂。

If you're using tomcat, you can try their utf8 encoding filter (add it to your web.xml of course). Their filter is called org.apache.catalina.filters.SetCharacterEncodingFilter, or if you don't want to depend on 3rd party then you can peek at their source code and write your own, it's not very complicated.

另请参阅
http://wiki.apache。 org / tomcat / FAQ / CharacterEncoding