At the beginning of the jsp file, it is best to add the following code. Now, the general IDE will automatically set the storage type to UTF-8. If you use Notepad for development, you need to select UTF-8 in the saved format.
% @ Page pageEncoding = "UTF-8" %
If there are still garbled characters, check whether the character set is set in HTML. If not, add:
<Meta http-equiv = Content-Type content = "text/html; charset = UTF-8"/>
Refresh the page after saving the file. If garbled characters still exist, the database garbled characters will not be more than 10.
Take Mysql as an example. During installation, we generally select the character set type as UTF-8. However, in Windows-based development environments, Mysql often does not support the UTF-8 format and needs to modify the encoding type.
Stop running Mysql, open the installation directory of Mysql, open the my. ini configuration file, and change UTF-8 to GBK at lines 57 and 81. default-character-set = GBK
Redeploy the project to solve the garbled problem.