更改Eclipse的编码字符 [英] changing the encode characters for Eclipse

查看:123
本文介绍了更改Eclipse的编码字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我做了所有这些配置:


  http://uploads.siteduzero.com/files/388001_389000/388662.png 
http://uploads.siteduzero.com/files/388001_389000 /388661.png
http://uploads.siteduzero.com/files/388001_389000/388660.png
http://uploads.siteduzero.com/files/388001_389000/388659.png


 窗口>首选项>一般>工作区> 其他UTF-8

但是,我仍然在我从我的数据库,知道编码是完美的(JSP页面):


http://img15.hostingpics。 net / pics / 136324Capturer4.jpg


我写在我的JSP页面顶部: / p>

 <%@ page pageEncoding =UTF-8%> 

,并将其作为我页面的标题

 < meta charset =utf-8/> 


解决方案

如果在<$ c中添加下一个参数$ c> eclipse.ini :

  -Dfile.encoding = UTF-8 

创建新工作区或删除 .metadata 目录在您当前的工作空间(在这种情况下,您可能会丢失自定义配置,如编译,清理...),所有配置(对于Java,XML,控制台,JSP,HTML ...),默认情况下, UTF-8 编码。



另一种方式,如果您使用的是Glassfish 4(用于Java EE 7),则默认编码字符集由操作系统定义。您可以检查如果您使用JSP或Servlet进行测试并打印:

  System.getProperty(file.encoding)


How do I to change the encoding on Eclipse ?

I did all of these configurations:

http://uploads.siteduzero.com/files/388001_389000/388662.png
http://uploads.siteduzero.com/files/388001_389000/388661.png
http://uploads.siteduzero.com/files/388001_389000/388660.png
http://uploads.siteduzero.com/files/388001_389000/388659.png

And

Window > Preferences > General > Workspace > 'Other UTF-8'

But, I still get this on my webpage which I had extracted from my DataBase, knowing that the encoding there is perfect (JSP page) :

http://img15.hostingpics.net/pics/136324Capturer4.jpg

and I wrote this in the top of my JSP page :

<%@ page pageEncoding="UTF-8"%>

and this into head tags of my page

<meta charset="utf-8" />

解决方案

If you add the next argument in the eclipse.ini:

-Dfile.encoding=UTF-8

And you create a new workspace or delete the .metadata directory in your current workspace (in that case, you can lost your custom configurations, like formating, cleanup...), all configurations (for Java, XML, console, JSP, HTML...) have, by default, UTF-8 encoding.

In another way, if you are using Glassfish 4 (for Java EE 7), the default encoding charset is defined by the operative system. You can check that if you test with a JSP or Servlet and print:

System.getProperty("file.encoding")

这篇关于更改Eclipse的编码字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆