Tomcat不支持中文,怎样实现中文文件名的文件下载? 临时解决方法为添一个uri编码转换,文件传输的过滤器 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 String x = "http://www.myweb.com/信息/信息.gif"<a href=<%= java.net.URLEncode.encode(x)%>信息</a> tmpStr:要显示的tmpStr1 = new String(tmpStr.getBytes("GB2312"),"ISO8859_1");GB2312:你想对应的中文字体 如果是html文件,又不打算用jsp改写有什么办法用tomcat跑中文名.html吗 多谢各位相助,有关中文与unicode之间转换问题以下方法可以解决问题是调用response.sendRedirect(urlFile)时仍提示找不到指定文件(urlFile:包含中文文件名的文件路径)//输出时的中文转换函数 public String getStrOut(String string){ try{ String temp_p=string; byte[] temp_t=temp_p.getBytes("ISO8859-1"); String temp=new String(temp_t); temp=(temp.equals("null"))?"":temp; temp=(temp==null)?"":temp; return temp; }catch(Exception e){} return "null"; }//中文转换为unicode public String ChineseStringToAscii(String s) { try { CharToByteConverter toByte = CharToByteConverter.getConverter("gb2312"); byte[] orig = toByte.convertAll(s.toCharArray()); char[] dest = new char[orig.length]; for (int i=0;i<orig.length;i++) dest[i] = (char)(orig[i] & 0xFF); return new String(dest); } catch (Exception e) { System.out.println(e); return s; } } //unicode转换为中文 public static String AsciiToChineseString(String s) { char[] orig = s.toCharArray(); byte[] dest = new byte[orig.length]; for (int i=0;i<orig.length;i++) dest[i] = (byte)(orig[i]&0xFF); try { ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312"); return new String(toChar.convertAll(dest)); } catch (Exception e) { System.out.println(e); return s; } } eclipse struts2中导入方法重写的问题 在jsp页面数据显示格式问题 高手指教:日期比较的问题 在AIX fileinputstream 中文问题 struct中表单中多个提按纽,如何区别! 两种jsp连接SqlServer的比较,迷惑? jsp连接数据库问题 在线等,mysql问题,急啊 关于提交 jsp连接数据库????如何不使用jdbc and odbc?? 如何解决这个错误? 这里的高手都死到哪里去了,叫我们菜鸟怎么活啊!
tmpStr1 = new String(tmpStr.getBytes("GB2312"),"ISO8859_1");
GB2312:你想对应的中文字体
多谢各位相助,有关中文与unicode之间转换问题以下方法可以解决
问题是调用response.sendRedirect(urlFile)时仍提示找不到指定文件
(urlFile:包含中文文件名的文件路径)//输出时的中文转换函数
public String getStrOut(String string){
try{
String temp_p=string;
byte[] temp_t=temp_p.getBytes("ISO8859-1");
String temp=new String(temp_t);
temp=(temp.equals("null"))?"":temp;
temp=(temp==null)?"":temp;
return temp;
}catch(Exception e){}
return "null";
}//中文转换为unicode
public String ChineseStringToAscii(String s) {
try {
CharToByteConverter toByte = CharToByteConverter.getConverter("gb2312");
byte[] orig = toByte.convertAll(s.toCharArray());
char[] dest = new char[orig.length];
for (int i=0;i<orig.length;i++)
dest[i] = (char)(orig[i] & 0xFF);
return new String(dest);
}
catch (Exception e) {
System.out.println(e);
return s;
}
}
//unicode转换为中文
public static String AsciiToChineseString(String s) {
char[] orig = s.toCharArray();
byte[] dest = new byte[orig.length];
for (int i=0;i<orig.length;i++)
dest[i] = (byte)(orig[i]&0xFF);
try {
ByteToCharConverter toChar = ByteToCharConverter.getConverter("gb2312");
return new String(toChar.convertAll(dest));
}
catch (Exception e) {
System.out.println(e);
return s;
}
}