Не отображается кирилица в консоли

У меня не читабельный вывод русских символов в консоли после запуска тестов

Что было попробовано:

№1 Изменить кодировку в File->Settings>Editor->File Encodings Global Encoding и Project Encoding выбрал (перед этим проверил что везде в системе по умолчанию русский язык, то есть в Региональных настройках) и Default Encoding for properties files поставил UTF-8

№2 Внизу проекта в нижнем правом углу проверил UTF-8

№3 Проверил в chcp было 866 в cmd

№4 В файлах Idea IntelliJ IDEA Community Edition 2018.2.8\bin\idea.exe.vmoptions и idea64.exe.vmoptions, также доступные через Help->Edit Custom VM Options..., я добавил строку -Dfile.encoding=UTF-8.

№5 Во всех pom.xml прописал кодировку

<encoding.type>UTF-8</encoding.type>

<project.build.sourceEncoding>${encoding.type}</project.build.sourceEncoding> <project.reporting.outputEncoding>${encoding.type</project.reporting.outputEncoding> <file.encoding>${encoding.type}</file.encoding>

№6 А так же добавлял параметр -Dfile.encoding=UTF-8 в строке запуска конфигурации (Edit configurations) clean test -pl tr2mongaranty-component-test-bdd -fae -P bdd-tests,sbpegas-mon-qa -DfailIfNoTests=false -Dfile.encoding=UTF-8 -Dcucumber.options.tags=@algIvan

При том если я просто создаю класс и печатаю русские символы всё ок.

Help

    "C:\Program Files\Java\jdk1.8.0_281\bin\java.exe" -Dmaven.multiModuleProjectDirectory=C:\Users\kakty\Desktop\JavaDela\cc-tr2mongarantee1234 -Dmaven.home=B:\Mav\apache-maven-3.5.2 -Dclassworlds.conf=B:\Mav\apache-maven-3.5.2\bin\m2.conf "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.8\lib\idea_rt.jar=51889:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.2.8\bin" -Dfile.encoding=UTF-8 -classpath B:\Mav\apache-maven-3.5.2\boot\plexus-classworlds-2.5.2.jar org.codehaus.classworlds.Launcher -Didea.version=2018.2.8 -Dmaven.repo.local=C:\Users\kakty\.m2\repository clean test -pl tr2mongaranty-component-test-bdd -fae -P bdd-tests,sbpegas-mon-qa -DfailIfNoTests=false -Dfile.encoding=UTF-8 -Dcucumber.options.tags=@ivan1
[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building CC - TR2MONGARANTY - Testing - BDD CURRENT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ tr2mongaranty-component-test-bdd ---
[INFO] Deleting C:\Users\kakty\Desktop\JavaDela\cc-tr2mongarantee1234\tr2mongaranty-component-test-bdd\target
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ tr2mongaranty-component-test-bdd ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] Copying 7 resources
[INFO] Copying 4 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ tr2mongaranty-component-test-bdd ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 36 source files to C:\Users\kakty\Desktop\JavaDela\cc-tr2mongarantee1234\tr2mongaranty-component-test-bdd\target\classes
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/UtilSteps.java:[149,17] withTimeout(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/UtilSteps.java:[152,17] pollingEvery(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/UtilSteps.java:[186,17] withTimeout(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/UtilSteps.java:[189,17] pollingEvery(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/UtilSteps.java:[406,17] withTimeout(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/UtilSteps.java:[409,17] pollingEvery(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/UtilSteps.java:[426,17] withTimeout(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/UtilSteps.java:[429,17] pollingEvery(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/IntegrationSteps.java:[103,17] withTimeout(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[WARNING] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/IntegrationSteps.java:[106,17] pollingEvery(long,java.util.concurrent.TimeUnit) in org.openqa.selenium.support.ui.FluentWait has been deprecated
[INFO] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/IntegrationSteps.java: C:\Users\kakty\Desktop\JavaDela\cc-tr2mongarantee1234\tr2mongaranty-component-test-bdd\src\main\java\ru.sberbank.pegas.at.bdd\stepdefs\IntegrationSteps.java uses unchecked or unsafe operations.
[INFO] /C:/Users/kakty/Desktop/JavaDela/cc-tr2mongarantee1234/tr2mongaranty-component-test-bdd/src/main/java/ru.sberbank.pegas.at.bdd/stepdefs/IntegrationSteps.java: Recompile with -Xlint:unchecked for details.
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ tr2mongaranty-component-test-bdd ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 189 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ tr2mongaranty-component-test-bdd ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\kakty\Desktop\JavaDela\cc-tr2mongarantee1234\tr2mongaranty-component-test-bdd\target\test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ tr2mongaranty-component-test-bdd ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
INFO Reflections took 219 ms to scan 1 urls, producing 2 keys and 39 values 
WARNING: Found tags option '~@Ignore'. Support for '~@tag' will be removed from the next release of Cucumber-JVM. Please use 'not @tag' instead.
INFO @algIvan

INFO �㭪樮���: �஢�ઠ �����⬮�

INFO 

INFO   @algIvan @ivan1

INFO   �業�਩: �஢�ઠ ���祭�� TRUE �����⬮�                                                                                                                                                       # features/simpleDeals+/GetLegalClientProfileAlgo/mon/Ivan1.feature:6

[INFO] Running �஢�ઠ �����⬮�
INFO     * ������:"�����" "���ਧ��� �� ��� ��� �������" "�業�਩: ���ਧ��� �� ��� ��� �������"                                                                                                    # UtilSteps.startImport(String,String,String)

INFO     ���� ⥪�騩 ���짮��⥫� "admin"                                                                                                                                                               # UtilSteps.setCurrentUser(String)

INFO     � �⪫�砥��� ��⨥ �ਭ�� ����� 蠣���                                                                                                                                                     # UtilSteps.switchGettingScreenshot(String)

INFO ���樠������ ���-�ࠩ��� � ������ 92120749-ed84-42be-94c4-7ffbdf84b3fb
INFO Attempt #1 to start web driver

И дальше стартует веб драйвер и идёт процесс прогона теста


Ответы (4 шт):

Автор решения: nikoshi
  1. Закрыть Intellij IDEA
  2. Добавить в файлы idea.exe.vmoptions и idea64.exe.vmoptions строку -Dconsole.encoding=UTF-8
  3. Запустить Intellij IDEA
→ Ссылка
Автор решения: ule

При решение этого вопроса пришлось испробовать много разных методов найденных на различных ресурсах решил их объединить вместе здесь.

№1 Изменить кодировку в File->Settings>Editor->File Encodings Global Encoding и Project Encoding выбрал (перед этим проверил что везде в системе по умолчанию русский язык, то есть в Региональных настройках) и Default Encoding for properties files поставил UTF-8

Примечание: Касательно галочки в поле Default Encoding for properties files UTF-8 на многих ресурсах пишут, что эту галочку нужно убрать, но мне помогло именно поставить её.

№2 Внизу проекта в нижнем правом углу проверить UTF-8

№3 Проверить в cmd командой chcp должно быть 866

Примечание: Если это не так Установить значение 866 для параметра OEMCP по пути \HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage

№4 В файлах Idea IntelliJ IDEA Community Edition 2018.2.8\bin\idea.exe.vmoptions и idea64.exe.vmoptions, также доступные через Help->Edit Custom VM Options..., добавить строку -Dfile.encoding=UTF-8 и -Dconsole.encoding=UTF-8.

№5 Во всех pom.xml прописал кодировку

<encoding.type>UTF-8</encoding.type>

<project.build.sourceEncoding>${encoding.type}</project.build.sourceEncoding> <project.reporting.outputEncoding>${encoding.type</project.reporting.outputEncoding> <file.encoding>${encoding.type}</file.encoding>

Примечание: Не обязательный пункт

№6 Добавить параметр -Dfile.encoding=UTF-8 в строке запуска конфигурации (Edit configurations) clean test “Ваши параметры конфигурации” -Dfile.encoding=UTF-8

№7 Добавить строки -Dconsole.encoding=UTF-8 и --Dfile.encoding=UTF-8 в файл idea64.exe.vmoptions по пути C:\Users\USER_NAME.IntelliJIdea....\config\idea64.exe.vmoptions

Примечание: Отличается от пункта №4

→ Ссылка
Автор решения: Htoya128

Актуально на 31.03.2022 для версии Intellij idea 2021.3

Приветствую, мне помогла смена кодировки не на UTF-8, а на кодировку которая стоит в системе по умолчанию(в моём случае это windows-1251). Если вы используете другую операционную систему, то у вас кодировка может отличаться. Чтобы всё заработало, поменяйте значение в параметрах "Global encoding:" и "Project encoding:" на "Default" (параметры располагаются в Intellij idea по пути File->Settings->Editor->File encodings).

→ Ссылка
Автор решения: Aleksandr

File - Settings - Editor - Console - Default Encoding - UTF-8

→ Ссылка