本人问题:mysql 保存 blob 类型数据 乱码 解决
未解决,???
之前 private string archiveValue; 导致 写入的进去之后的中文 都是乱码
改正后 ,即可
private byte[] archiveValue; // blob
其他解决方法
http://knight-black-bob.iteye.com/blog/2213090
--------------------------------------------------------------------------------------------------------------------------------
字符串乱码解决
1. new String ( str .getBytes("iso8859-1","utf-8"));
2.<%@ page contentType="text/html; charset=UTF-8"%>
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.过滤器
<filter> <filter-name>encodingFilter</filter-name> <filter-class> org.springframework.web.filter.CharacterEncodingFilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>UTF-8</param-value> </init-param> <init-param> <param-name>forceEncoding</param-name> <param-value>false</param-value> </init-param> </filter> <filter-mapping> <filter-name>encodingFilter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping>
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
<Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443" URIEncoding="UTF-8"/>
8. eclipse
9.
<action name="showOverAllXls" class="showOverAllDataAction" method="doXLS"> <result name="success" type="stream"> <param name="contentType"> application/octet-stream;charset=ISO-8859-1 </param> <param name="contentDisposition">attachment;fileName="${fileName}"</param> <param name="inputName">downloadFile</param> </result> </action>
10.sql
CREATE DATABASE `db` CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';
11.
<constant name="struts.i18n.encoding" value="utf-8" />
12.
HttpServletResponse response = null; response = ServletActionContext.getResponse(); request.setCharacterEncoding(”utf-8″); response.setContentType(”text/html;charset=utf-8″);
捐助开发者
在兴趣的驱动下,写一个免费
的东西,有欣喜,也还有汗水,希望你喜欢我的作品,同时也能支持一下。 当然,有钱捧个钱场(右上角的爱心标志,支持支付宝和PayPal捐助),没钱捧个人场,谢谢各位。
谢谢您的赞助,我会做的更好!
相关推荐
Mybatis 处理 CLOB、BLOB 类型数据
mysql写入或读取一段数据块时,数据类型为blob型,本代码详细介绍在mysqll中如何读写blob格式数据
mysql+Qt 下对blob数据类型操作
mysql导出工具,可导出无注释插入语句,表中字段有blob类数据,插入语句前还有锁表操作语句,适合多种场景
在JSP页面实现java的java.sql.BLOB类型的数据,文件上传.
PB中用OLE存取blob类型数据PB中用OLE存取blob类型数据PB中用OLE存取blob类型数据PB中用OLE存取blob类型数据PB中用OLE存取blob类型数据PB中用OLE存取blob类型数据PB中用OLE存取blob类型数据PB中用OLE存取blob类型数据
mysql数据库 中用blob存储image及file 数据blob的写入与提取 方法概要
MySQL BLOB类型 MySQL中,BLOB是一个二进制大型对象,是一个可以存储大量数据的容器,它能容纳不同大小的数据。 插入BLOB类型的数据必须使用PreparedStatement,因为BLOB类型的数据无法使用字符串拼接写的。 MySQL的...
语言Java,数据库mysql 批量获取Blob图片下载到本地,同时设置本地保存位置
SQLSERVER数据库中存储BLOB类型数据,在线等现在公司要求用PB6.5+SQLser
从oracle中的BLOB类型字段中取出照片,转存到mysql数据库中。思路是现将oracle中的照片存储在本地文件夹,在将本地图片上传到mysql中。
java中sqllite数据库blob数据类型的存取.docx
向数据库插入blob数据实例源码.rar 在mysql中通过。
欢迎访问百度贴吧 : 世态炎凉一依然 吧. 本项目事例来自 世态炎凉一依然 吧. 内容为商品展示,数据库采用mysql,商品图 片存储在数据库中
本文通过实例代码给大家介绍了mysql中blob数据处理方式,非常不错,具有一定的参考借鉴价值,需要的朋友参考下吧
向数据库插入blob数据实例源码--在mysql和oracle中通过.rar
Oralce 保存与读取Blob类型文件
Java中 Blob的插入与读取
有关上传文件保存到数据库为blob类型的例子,共大家参考学习
mysql导出的blob数据分析统计