java - JSP页面中文乱码
ringa_lee
ringa_lee 2017-04-18 10:23:56
0
5
322

<%@ page language="java" contentType="text/html; charset=UTF-8"

pageEncoding="UTF-8"%> <%request.setCharacterEncoding("utf-8");%> 头文件都是这样的,在JSP页面中调用数据库的数据放在list上并遍历显示出来 结果中文都是乱码,网上查大多数是说数据库编码与JSP页面不一致,我的mysql数据库是建立好了的,也不知道哪里修改,用了navicat这个数据库软件

ringa_lee
ringa_lee

ringa_lee

reply all (5)
Ty80

The problem with database encoding is that I couldn’t change the encoding of the database according to what was said on the Internet. Then I deleted all the databases and reinstalled them. The encoding was unified to utf8. I feel that reinstalling is more reliable. Pay attention when reinstalling the database. The encoding settings at the beginning are no problem, solved!

    Ty80
    1. Check page encoding

    2. Check database encoding

    3. Check web container encoding

    4. Check whether the filter is set, the encoding filter must be in front

      小葫芦

      I think it should be a database encoding problem. Where you debug the data, first determine where the chaos started, and then find corresponding countermeasures

        黄舟

        navicat does not recommend modifying the encoding by right-clicking the database. It is recommended to first edit the database结构和数据导出为sql, 然后新建一个数据库, 这时字符集选择utf8 -- UTF-8 Unicode排序规则选择utf8_general_ci, then import the original database content, and change the corresponding character set and sorting rules of the data table fields to the above

          刘奇

          Confirm database encoding and project encoding, response.getCharacterEncoding();

            Latest Downloads
            More>
            Web Effects
            Website Source Code
            Website Materials
            Front End Template
            About us Disclaimer Sitemap
            php.cn:Public welfare online PHP training,Help PHP learners grow quickly!