Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 621
Ceddoc Avatar asked Jun 14 '16 07:06

Ceddoc


People also ask

How do I change the default charset in Java?

Setting default character encoding or Charset Methods: There are various ways of specifying the default charset value in Java. java -Dfile. encoding="UTF-8" HelloWorld, we can specify UTF-8 charset. Method 2: Specifying the environment variable “JAVA_TOOLS_OPTIONS.”

What is the difference between ISO 8859 1 and UTF-8?

UTF-8 is a multibyte encoding that can represent any Unicode character. ISO 8859-1 is a single-byte encoding that can represent the first 256 Unicode characters. Both encode ASCII exactly the same way.


1 Answers

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.

like image 138
Ceddoc Avatar answered Sep 28 '22 20:09

Ceddoc