求救!Jsp能读取MySQL数据库并正常显示中文。但是插入数据时时变成了其他中文乱码,源码就补充

2025-03-25 20:40:34
推荐回答(4个)
回答1:

数据库改用gbk编码就可以了

回答2:

把第一句改为<%@page contentType="text/html;charset=GBK"%>

回答3:

String name = new String(request.getParameter("name).getBytes("ISO8859_1"),"GBK");

回答4:

String name=new String(request.getParameter("name").getBytes("iso8859-1"),"GB2312");