1

Faced a problem in displaying the Cyrillic alphabet. The problem is observed only on windows OS (mac and Linux displays as needed), the problem appeared after updating to 18 java. When outputting, instead of a correct description, we get artifacts. enter image description here

When changing the settings from utf8 to 1251, the rest of the encoding for the project breaks, but the error goes away

enter image description here

Tried all solutions from this thread IntelliJ IDEA incorrect encoding in console output. Nothing helped, like all the other options offered on the open spaces of the network.

Version IntelliJ IDEA 2022.1.2

When building, running tests through the console in maven, the situation is the same as in the idea

If change the version of jdk to java 17, the encoding error goes away and everything is displayed as it should

samabcde
  • 6,988
  • 2
  • 25
  • 41
  • 3
    I think some default encodings were changed into UTF-8 with Java 18. https://www.developer.com/java/java-18-features/ – akarnokd Jun 21 '22 at 12:40
  • See [JEP 400](https://openjdk.org/jeps/400). The solution is to make sure you specify a charset for `new String(byte[])`, String.getBytes(), InputStreamReader, and OutputStreamWriter. – VGR Jun 21 '22 at 13:15
  • *When changing the settings from utf8 to 1251, the rest of the encoding for the project breaks, but the error goes away* Not sure what that means, but if you've, say, imported source code from someone working on a proper OS with Unicode by default, you will indeed have problems if you set your IDE to a Windows 7/8 bit encoding when the source is *not* encoded that way. I would tend to transcode any 8-bit to UTF-8 and then set the IDE to UTF-8 – g00se Jun 21 '22 at 13:24

0 Answers0