Setting text file encoding per eclipse project

我与影子孤独终老i 提交于 2019-12-08 11:25:58

问题


I wanted to know if its posible to set a different file encoding per each project I have on eclipse.

I know that I can have different workspaces and set a different encoding for each one, but id like to have all my projects on one, if posible...


回答1:


Yes you can.

Open the Properties for the Project and select the 'Resource' tab. Set the 'Text file encoding' to what you want.

Make sure that all the files in the project have their Text file encoding set to 'Default (inherited from container)'

You can also set the defaults for everything in a Folder in the same way.




回答2:


I think it's possible.

1.Select your project.

2.Right click and select Properties.

3.Select Resource menu and you can choose your file encoding.




回答3:


This is not working with Eclipse Mars, for some file types, as eg JavaScript. For *.js files, the configuration "Determined from content type" is having precedence over the project's Resource configuration.

I've also tried to specify my JS directory encoding in .settings/org.eclipse.core.resources.pref, which is specific for the project, by defining encoding//src/main/webapp/js=ISO-8859-1, but then again the workspace configuration is having precedence.

I have a development environment with two distinct projects, one in UTF-8 (newer) and anoter in ISO-8859-1 (legacy). I would like to easily switch between them.

One solution I've found was to create two workspaces. It worked, but it seems rather awkward as instructions to other developers. So it would be desirable to really have such configurations on a per-project basis.



来源:https://stackoverflow.com/questions/36494326/setting-text-file-encoding-per-eclipse-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!