UTF8与UTF-8区别
前段时间写mybatis 连接Mysql数据库时 这个点卡了老长时间
XML 文件设置编码格式 UTF-8 但数据库不识别;
Mysql 数据库只识别 UTF8
<?xml version="1.0" encoding="UTF8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<!--核心配置文件-->
<configuration>
<!--<typeAliases>
<package name="com.lhw.pojo"/>
</typeAliases>-->
<environments default="development">
<environment id="development">
<transactionManager type="JDBC"></transactionManager>
<dataSource type="POOLED">
<property name="driver" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/mybatis?s
useSSL=true&useUnicode=true&characterEncoding=UTF-8"/>
<property name="username" value="root"/>
<property name="password" value="0000"/>
</dataSource>
</environment>
</environments>
<mappers>
<mapper resource="com/lhw/dao/UserMapper.xml"/>
</mappers>
</configuration>