Mysql: Java Web App and MySql 5.x UTF-8
November 8th, 2008 by jeremychoneTo fully support UTF-8 with mysql, make sure of the followings:
- Set HttpServletRequest UTF-8 character encoding.
request.setCharacterEncoding(”UTF-8″);
- Set HttpServletResponse UTF-8 character encoding
response.setContentType(”text/html; charset=UTF-8″);
- Create the Column, Table, or DB need to have the UTF8 charset and collation
CHARACTER SET utf8 COLLATE utf8_general_ci
- THE TRICK: Add the character encoding instruction in your JDBC URL
jdbc:mysql://localhost:3306/DATABASENAME?useUnicode=true&characterEncoding=UTF8
Related links: