简体   繁体   中英

Supplementary character support in Java web application with Mysql

I am able to enter supplementary chars in textbox but it doesn't get save in database. I am using MySql database. I have used spring and hibernate in my application. What change should I make to enable supplementary chars support in my application?

Following is my database connection string:

url="jdbc:mysql://localhost:3306/users?useUnicode=true&characterEncoding=utf8"

You need to do following changes to make your application supplementary character compatible:

  1. Remove characterEncoding ie utf8 from your url and make it as below:

    url="jdbc:mysql://localhost:3306/users?useUnicode=true"

  2. You need to edit my.ini file from MySQL Server directory. If you have Windows 64bit OS, then you may find it at following location:

    C:\\ProgramData\\MySQL\\MySQL Server 5.6\\my.ini

Open this file using any text editor such as Notepad++ and change the following parameter value:

From

character-set-server=utf8

To

character-set-server=utf8mb4

After making the above changes your application should support Supplementary characters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM