maven项目操作数据库控制台中文乱码
先查看一下自己数据库以及对应的表的字符集是否是UTF-8
2.在属性文件后面加上以下内容:
jdbc:mysql://localhost:3306/数据库名称? useUnicode=true&characterEncoding=UTF-8
3.在idea中将字符集都设置为utf-8
File-Settings-Editor-FileEncodings
Global Encoding:UTF-8
Project Encoding:UTF-8
Default encoding for properties files:UTF-8
同时将Transparent native-to-ascii conversion进行勾选
Create UTF-8 files: with NO BOM
4.在Settings中搜索maven,然后在Runner中VM Options加上以下内容::
-Dfile.encoding=GB2312