简体   繁体   中英

IntelliJ uses wrong encoding

I am using intelliJ 2017.3 CE, I have a strange behaviour which i cannot resolve although I tried everything I found to that topic.

For simplicity I extracted the root cause of my problem, IntelliJ does not use the desired encoding in my case UTF-8. Here is my simple class:

public static void main(String[] args) {
    System.out.println("äüö");
}

running this class leads to the following output:

13:03:47: Executing task 'StringTest2.main()'...
:core:compileJava UP-TO-DATE
:core:processResources UP-TO-DATE
:core:classes UP-TO-DATE
:core:compileTestJava
:core:processTestResources UP-TO-DATE
:core:testClasses
:core:StringTest2.main()
äüö


BUILD SUCCESSFUL in 2s
5 actionable tasks: 2 executed, 3 up-to-date
13:03:49: Task execution finished 'StringTest2.main()'.

Here you can see the encoding of the file

在此处输入图片说明

here are the settings of my intellij installation 在此处输入图片说明

What I tried:

  • added to my gradle.properties: systemProp.file.encoding=utf-8
  • created a run configuration for that class where i defined jvm settings: -Dfile.encoding=utf-8
  • executed a testcase where this problem originally occured from command line (gradle) but the error also occured
  • Tested the class on a different pc (mac) with intellij and there the log out was as expected.

I dont know what else I can try.

The console still uses the platform encoding .

Use

-Dconsole.encoding=UTF-8

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