乱码解决九步曲
来源:互联网 发布:如何建数据库 编辑:程序博客网 时间:2024/06/07 02:46
一、数据库
1.创建数据库时启动mysql使用参数
mysql -uroot --default-character-set utf8
2.创建数据库
create database summer(库名) default character set utf8;
执行sql脚本
3.创建表
create table emp(表名)(列表.....)default character set utf8;
4.sql脚本的执行
source /home/tarena/phone.sql(sql脚本)
5.修改mysql 数据库连接url
jdbc:mysql://localhost:3306/summer(库名)?useUnicode=true&characterEncoding=utf8
二、页面
6.提交时使用post提交
<form action="xxx.do" method="post">
7.jsp页面设置字符集
<%@page pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
三、处理器
8.使用过滤器filter
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
9.在地址栏传中文的问题
服务器端将传输过来的中文进行进行下面的解码:
String name=new String(request.getParameter("name").getBytes("ISO8859-1"),"utf-8");
1.创建数据库时启动mysql使用参数
mysql -uroot --default-character-set utf8
2.创建数据库
create database summer(库名) default character set utf8;
执行sql脚本
3.创建表
create table emp(表名)(列表.....)default character set utf8;
4.sql脚本的执行
source /home/tarena/phone.sql(sql脚本)
5.修改mysql 数据库连接url
jdbc:mysql://localhost:3306/summer(库名)?useUnicode=true&characterEncoding=utf8
二、页面
6.提交时使用post提交
<form action="xxx.do" method="post">
7.jsp页面设置字符集
<%@page pageEncoding="utf-8" contentType="text/html;charset=utf-8" %>
三、处理器
8.使用过滤器filter
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
9.在地址栏传中文的问题
服务器端将传输过来的中文进行进行下面的解码:
String name=new String(request.getParameter("name").getBytes("ISO8859-1"),"utf-8");
- 乱码解决九步曲
- 乱码 乱码 乱码 解决 解决 解决
- 乱码解决
- 解决乱码
- 解决乱码
- 乱码解决
- 乱码解决
- 乱码解决
- 解决乱码
- 解决了乱码问题
- include乱码解决
- 解决DreamWeaver2004(7.01)乱码
- CodeSmith 乱码之解决
- 解决中文乱码问题
- bugfree乱码解决
- Servlet 中文乱码解决
- ajax中文乱码解决
- mysql解决乱码
- windows下apache+fastcgi+cpp环境搭建
- 各种查找、排序的时间复杂度
- SQLServer自定义函数
- socket网络编程01
- 子类化控件
- 乱码解决九步曲
- Annotation的总结
- Netbeans,glassfish服务器部署多个项目时出现ContextRootInfo不能转化异常
- Denuo DirectUI 支持的控件
- public final int readInt()
- vsftpd配置
- Denuo DirectUI 设计器
- 由adt和sdk升级引发的血案!!!
- 什么是Socket,为什么要用Socket