1.创建数据库和表时,确保字符集是“utf8”。
2.项目配置文件添加如下配置,以yml文件为例。
http: encoding: charset: UTF-8 enabled: true force: true
3.数据库连接别忘了加上红色部分。
jdbc:mysql://host:3306/test_db?useUnicode=true&characterEncoding=UTF-8
1.创建数据库和表时,确保字符集是“utf8”。
2.项目配置文件添加如下配置,以yml文件为例。
http: encoding: charset: UTF-8 enabled: true force: true
3.数据库连接别忘了加上红色部分。
jdbc:mysql://host:3306/test_db?useUnicode=true&characterEncoding=UTF-8