中文问题:英文操作系统上,中文名的图片无法显示 由于上传文件的时候没有给文件重命名,所以网站发表的文章中引用的图片很多都是中文名称的图片,而这些图片在英文操作系统上就无法显示了。求各位指教下,这个问题该怎么解决? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 显示文件名字时做一下转码处理,new String(fileName.getBytes(),"ISO-8859-1") 当然也可以试试GBK什么的 问题解决了,只是不知道这个方法到底好不好?页面采用的是GBK编码的:<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%><META http-equiv="Content-Type" content="text/html; charset=GBK">我是这样解决问题的://FileInputStream fin = new FileInputStream(filepath);FileInputStream fin = null;try { fin = new FileInputStream(new String(filepath.getBytes("iso8859-1"), "GBK"));} catch (Exception e) { try { fin = new FileInputStream(new String(filepath.getBytes("iso8859-1"), "UTF-8")); } catch (Exception e1) { try{ fin = new FileInputStream(filepath); }catch (Exception e2){ } }} 紧急求救 新手真心求教关于MyEclipse连接SQL SERVER 2000的问题 ibatis删除数据后读取出错!! 如何让quartz每90秒执行一次 JRun服务器下,JSP不能访问Servlet? ssh 是不是少包 了 ? 500分请教struts问题 求硕士论文思路 CMP 的问题 请问我写了一个ejb和相应接口要放在什么目录下,客户端才能找到? struts2标签 求高校教学团队申报与评审系统的需求分析
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%>
<META http-equiv="Content-Type" content="text/html; charset=GBK">我是这样解决问题的://FileInputStream fin = new FileInputStream(filepath);
FileInputStream fin = null;
try {
fin = new FileInputStream(new String(filepath.getBytes("iso8859-1"), "GBK"));
} catch (Exception e) {
try {
fin = new FileInputStream(new String(filepath.getBytes("iso8859-1"), "UTF-8"));
} catch (Exception e1) {
try{
fin = new FileInputStream(filepath);
}catch (Exception e2){
}
}
}