Eclipe - 处理java文件中的重音符号

时间:2015-11-30 05:25:02

标签: java eclipse utf-8 internationalization eclipse-jdt

java文件中的注释是用法语写的。然而,代码变得扭曲。我可以使用eclipse中的哪个设置,以便正确呈现代码和注释。

// R�cup�ration des params d'envoi mail du fichier BFC2.properties

texte.append("Vous recevez ce mail automatique suite � la cr�ation d�un ou plusieurs nouveaux items dans");
        texte.append("l�application FERIA");

1 个答案:

答案 0 :(得分:0)

我真的希望这是一个大学项目。 无论如何,我猜你正在使用Windows,这意味着源文件的默认字符编码将是Windows-1252(因为它是法语)。
您需要的是在项目级别和单个文件级别更改文件编码。

首先,您需要选择当前项目,右键单击它并从弹出菜单中选择Properties

enter image description here

然后,您可以为项目设置全局文件编码:

enter image description here

这应该为新文件夹和文件设置有效编码。但是,它不会改变现有编码。要更改文件的编码,您需要右键单击它并选择其属性:

enter image description here

只有这样,您才能真正更改当前文件的编码:

enter image description here

你的工作遗憾地还没有结束,因为现在你必须手工修复破碎的口音。对不起。
更好的选择是实际使用ResourceBundles - 您可以阅读有关此方法的更多信息here。这可以通过Eclipse内置的字符串externationalization功能(Source - > Externalize Strings...)轻松完成。