sevlet 中的 UTF-8 问题

发布于 2024-12-22 14:18:41 字数 376 浏览 1 评论 0原文

当我尝试从 jsp 到 sevlet 获取参数 'Ђимими ESO11 Ђимими ' 时,该值的形式为 'تÙÙÙÙات ESO '。我在 servlet 代码中设置了以下内容

  response.setContentType("text/html; charset=UTF-8");
  response.setCharacterEncoding("UTF-8");

,并在 jsp 中进行了以下设置

   <%@ page contentType="text/html; charset=UTF-8" %>
   <%@page pageEncoding="UTF-8"%>

While i trying to getting parameter 'تقويمات ESO11 تقويمات 'from jsp to sevlet the value is of the form 'تÙÙÙÙات ESO '.I set following in servlet code

  response.setContentType("text/html; charset=UTF-8");
  response.setCharacterEncoding("UTF-8");

and in jsp following settings are made

   <%@ page contentType="text/html; charset=UTF-8" %>
   <%@page pageEncoding="UTF-8"%>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2024-12-29 14:18:41

如果您通过 HTTP GET 发送此数据,您可能需要调整 URIEncoding 选项。如果您使用apache tomcat,则需要配置UTF-8。

请参阅 http://tomcat.apache.org/tomcat-5.5-doc /config/http.html

一个 server.xml 示例:

<Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true"
               URIEncoding="UTF-8"
   />

如果这不是您的问题,可以在此处找到更详细的帖子:如何让 UTF-8 在 Java Web 应用程序中工作?

If you send this data via HTTP GET you need possibly to adjust the URIEncoding option. If you use apache tomcat you need to configure UTF-8.

see http://tomcat.apache.org/tomcat-5.5-doc/config/http.html

a server.xml example:

<Connector port="8080" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true"
               URIEncoding="UTF-8"
   />

If this is not your problem a more detailed post can be found here: How to get UTF-8 working in Java webapps?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文