在jsp页面中显示特殊字符 [英] display special characters in jsp page
问题描述
如何在jsp页面上显示正确的内容或需要在tomcat服务器中进行任何配置...?
How to display right content on jsp page or any configuration need to done in tomcat server...?
在jsp上显示:Hello G�nter
原始内容:Hello Günter
我们执行以下操作,但不起作用.
We do the following but its not working.
<%@ page language="java" contentType="text/html; charset=ISO-8859-15"
pageEncoding="UTF-8"%>
推荐答案
正如大多数其他人所说,您可能应该检查文件系统上实际文件的编码.即使指示服务器提供UTF-8,如果文件损坏,您也会得到错误的输出.
As most other people have said, you should probably check the encoding of the actual file on the file system. Even if the server is instructed to serve out UTF-8, if the file is mangled, you'll get the wrong output.
在最常用的工具中,您可以使用Notepad ++或Eclipse来检查文件的编码.在Notepad ++中,打开文件,然后单击编码标签.确保选择编码为UTF-8".
Among the most common tools, you can use Notepad++ or Eclipse to check the encoding of the file. In Notepad++, open the file and click the Encoding tab. Make sure that "Encode as UTF-8" is selected.
在eclipse中,您需要在项目资源管理器中右键单击该文件.在资源标签中,底部属性是文本文件编码".确保在此处选择了UTF-8.
In eclipse, you need to right-click the file in the project explorer. In the Resource tab, the bottom property is "Text file encoding". Make sure that UTF-8 is selected there.
仅供参考,我前一段时间在Weblogic上遇到了类似的编码问题.参数在属性中的顺序会影响页面的行为方式.您可以在此处找到更多信息,尽管我认为这并不适用解决您的问题.
FYI, I had a similar encoding issue a while ago, on Weblogic. The order of the parameters in the attributes affected the way the page behaved. You can find more info here, although I don't think it applies to your problem.
这篇关于在jsp页面中显示特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!