您的位置:首页 > 编程语言 > Java开发

Eclipse必须设置编码格式的几个地方

2017-05-12 10:21 225 查看
1.工作空间编码格式    Windows——preference——Workspace——other(设置为UTF-8)   这种编码格式对整个工作空间的文件都有效

   


2.window -> Preferences -> general -> Workspac -> Text file encoding ->java source  file(设置为utf-8)

  


3. Window->Preferences->General
->Content Type->Text->JSP 最下面设置为UTF-8

4.设置tomcat的编码


方案:


1、找到tomcat的server.xml配置文件




2、添加URIEncoding="UTF-8"

[html] view
plain copy

<Connector port="8080" protocol="HTTP/1.1"  

               connectionTimeout="20000"  

               redirectPort="8443"  URIEncoding="UTF-8" />  

代码中规定了Tomcat监听HTTP请求的端口号等信息。在这里添加了一个属性:URIEncoding,将该属性值设置为UTF-8,即可让Tomcat(默认ISO-8859-1编码)以UTF-8的编码处理get请求,避免中文乱码问题。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: