本人问题:mysql 保存 blob 类型数据 乱码 解决
未解决,???
之前 private string archiveValue; 导致 写入的进去之后的中文 都是乱码
改正后 ,即可
private byte[] archiveValue; // blob
其他解决方法
http://knight-black-bob.iyunv.com/blog/2213090
--------------------------------------------------------------------------------------------------------------------------------
字符串乱码解决
1. new String ( str .getBytes("iso8859-1","utf-8"));
2.
3.mysql my.ini
[mysql]
max_allowed_packet=500M
default-character-set=utf8
[mysqld]
character-set-server=utf8
[client]
default-character-set = utf8
[mysql]
default-character-set = utf8
4.数据库
url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8
username=root
password=root
有人说 url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8
5.过滤器
encodingFilter
org.springframework.web.filter.CharacterEncodingFilter
encoding
UTF-8
forceEncoding
false
encodingFilter
/*
6.添加@RequestMapping注解,配置produces的值
@RequestMapping(value = "/add", produces = {"application/json;charset=UTF-8"})
@RequestMapping(value = "/add", params = {"callback"}, produces = {"text/javascript;charset=UTF-8"})
7. tomcat server.xml
8. eclipse
DSC0000.png (5.88 KB, 下载次数: 20)
2016-9-30 12:06 上传
9.
application/octet-stream;charset=ISO-8859-1
attachment;fileName="${fileName}"
downloadFile
10.sql
CREATE DATABASE `db`
CHARACTER SET 'utf8'
COLLATE 'utf8_general_ci';
11.
12.
HttpServletResponse response = null;
response = ServletActionContext.getResponse();
request.setCharacterEncoding(”utf-8″);
response.setContentType(”text/html;charset=utf-8″);