search

Home  >  Q&A  >  body text

eclipse设置单个项目编码

公司的不同项目是不同的编码格式 比如后台定时之类的程序是GBK 管理平台是UTF-8。现在eclipse导入过来之后在项目上点右键更改项目的编码格式为GBK,但是下面的文件仍然是UTF-8(我在Window->Preferences->General->Workspace->Text file encoding这个里面设置的是UTF-8),请问怎么单独设置某个工程的所有编码?谢谢

迷茫迷茫2798 days ago884

reply all(1)I'll reply

  • ringa_lee

    ringa_lee2017-04-21 10:58:52

    There are three levels of coding settings in Eclipse: global, project, and file. The encoding of the file will override the encoding of the project, and the encoding of the project will override the global encoding.

    My guess: Although your project encoding is changed to GBK, it is only effective for new files. If the old file in the project is UTF-8 encoded, its encoding will overwrite the project encoding, that is, it will not be affected by the project encoding you set. The solution is: Right-click on the file and set the encoding of the file in the file properties.

    But if the file is originally encoded in UTF-8 and you forcibly change it to GBK encoding, the file will be garbled and the project will no longer be compiled. The solution is: first save the file as GBK encoding, and then set its encoding in the file properties. Very troublesome. Therefore, for an existing project, do not change its coding unless necessary.

    For reference only.

    reply
    0
  • Cancelreply