Dian see a default encoding database
By entering the mysql password:
Enter the show variables like 'character%'; see mysql character set
The default encoding when installing MySQL database is latin1, you may want to use other coding practical use.
Two Dian modify codes
modify the my.ini MySQL configuration file (windows system), in the mounted position of the directory.
1. [client] the added:
default-Character-SET = UTF8
2. append [mysqld] at:
Character-SET = UTF8-Server
3. append [MySQL] at:
default-Character-SET = UTF8
The last service restart.
The above is the view the database character set.
We can see solutions garbled characters configured in web.xml in real time whether it is useful to add a filter:
This solution character garbled filter tried helpful!
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
Secondly, we need to see in our database, time to build their own table, whether this corresponds to the utf-8 character set
We can also properties in the configuration file,
This column: jdbc.url = jdbc: mysql: /// database name useUnicode = true & characterEncoding = utf-8 join useUnicode = true & characterEncoding = utf-8?
Or? CharactorEncoding = utf8 both themselves have used. Probably say that we get the database connection object method does not give us character limit set!
Finally, we can also set it in the server.xml tomcat in
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" />