Java属性在Eclipse中的UTF-8编码 [英] Java properties UTF-8 encoding in Eclipse
问题描述
ISO-xx
转换为 utf8
。一切顺利,属性文件除外。我在 eclipse.ini
中添加了 -Dfile.encoding = UTF-8
,正常文件工作正常。属性然而显示一些奇怪的行为。 如果我从记事本++复制 utf8
编码属性并将其粘贴到Eclipse中,表演和工作正常。当我重新打开属性文件时,我看到一些Unicode字符而不是正确的字符,如:
Zur\\\ï\\\¿\\ \\ u00BDck而不是Zurück
但应用仍然可以正常工作。
如果我开始编辑属性,添加一些特殊字符并保存,它们正确显示,但是它们不起作用,并且以前所有工作的特殊字符都不再工作。
当我将本地版本与CVS进行比较时,我可以在远程文件上正确看到特殊字符,更新后我再次启动:应用程序工作,但Eclipse显示Unicode字符。
我尝试通过右键单击并选择其他:UTF8来更改文件编码,但没有帮助。它还说:从内容确定:ISO-8859-1
我使用的是基于Eclipse 3.3的Java 6和Jboss Developer
我可以通过编辑Notepad ++中的属性并将其粘贴到Eclipse中,但是如果有人可以帮助我在Eclipse中修复这个问题,我将不胜感激。
不要浪费你的时间,你可以使用
I've recently had to switch encoding of webapp I'm working on from ISO-xx
to utf8
. Everything went smooth, except properties files. I added -Dfile.encoding=UTF-8
in eclipse.ini
and normal files work fine. Properties however show some strange behaviour.
If I copy utf8
encoded properties from Notepad++ and paste them in Eclipse, they show and work fine. When I reopen properties file, I see some Unicode characters instead of proper ones, like:
Zur\u00EF\u00BF\u00BDck instead of Zurück
but app still works fine. If I start to edit properties, add some special characters and save, they display correctly, however they don't work and all previously working special characters don't work any more.
When I compare local version with CVS I can see special characters correctly on remote file and after update I'm at start again: app works, but Eclipse displays Unicode chars.
I tried changing file encoding by right clicking it and selecting „Other: UTF8" but it didn't help. It also said: „determined from content: ISO-8859-1"
I'm using Java 6 and Jboss Developer based on Eclipse 3.3
I can live with it by editing properties in Notepad++ and pasting them in Eclipse, but I would be grateful if someone could help me with fixing this in Eclipse.
Don't waste your time, you can use Resource Bundle plugin in Eclipse
这篇关于Java属性在Eclipse中的UTF-8编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!