今天碰到idea控制台乱码问题,在设置-Dfile.encoding=GBK后也不能解,!
网上也查不到解决方案,那就记录一下我是怎么解决的;
其实乱码的根源问题就是我设置jdk1.8的问题,在pom.xml里设置jdk1.8多个编码,在setting里面没有编码,所有在setting里设置就一定会乱码,在pom.xml就不会乱码
<profile>
<id>jdk-1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
这是在setting里全局设置jdk的代码
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<target>1.8</target>
<source>1.8</source>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
这是在pom.xml文件你设置jdk的代码
问题的关键就是多了个encoding=utf-8,你可以检查一下是不是和我一样的问题