简体   繁体   中英

IntelliJ 14 keeps switching encoding to UTF-8

I have a project which is encoded in ISO-8859-1 (an historic choice that I can't change).

I Set my IDE, IntelliJ 14.1.1 Ultimate, to in ISO-8859-1 everywhere : My encoding setting

(My code is in the folder specificaly set in ISO-8859-1)

The encoding.xml looks good:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="Encoding" defaultCharsetForPropertiesFiles="windows-1252">
    <file url="file://$PROJECT_DIR$" charset="ISO-8859-1" />
    <file url="file://$PROJECT_DIR$/mydir" charset="ISO-8859-1" />
    <file url="file://$PROJECT_DIR$/mydir/...ASpecificJavaFileThatIveTroubleWith.java" charset="ISO-8859-1" />
    <file url="PROJECT" charset="ISO-8859-1" />
  </component>
</project>

My .idea is not on commited on git because it's not the standard IDE.

But when I Work on some file, intelliJ keeps switching the encoding to UTF-8 on save. I converted the file to ISO-8859-1 several times, opened it with another editor to be sure that is no UTF-8 char remaining. But despite my efforts, after a few edits, the file is automatically switched to UTF-8.

I restart the IDE several times, no change.

Any hint?

The answer wasn't there, i finally had the answer of one of my friend who is an intelliJ guru and he advice me to check de .editorconfig at the project root. And he was right, charset was utf-8 and when I switched it to ISO-8859-1 he stopped converting my files to utf-8.

I guess disabling EditorConfig Plugin will works too.

Go to File -> Settings ((Ctrl | Cmd) + Alt + S)

转到文件 - >设置

Change to ISO-8859-1 更改为ISO-8859-1

I followed your advices and managed to convince my boss that we need to change the project encoding.

So I start to convert everything in UTF-8, hoping that'll do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM