当前位置: 技术问答>java相关
上传中文名称文件到linux服务器乱码,关于解决办法的设想请大家指正....
来源: 互联网 发布时间:2015-09-19
本文导语: 服务器环境是Red Hat7.1(English), Apache1.3.22 , Tomcat 4.0.1,oracle817. 通过jspsmartupload组件上载中文名称文件,服务器端文件乱码, 文件不能显示和下载。 我想通过汉化Rh7.1来解决问题,但担心: 汉化后,oracle,apache,tomcat还...
服务器环境是Red Hat7.1(English), Apache1.3.22 , Tomcat 4.0.1,oracle817.
通过jspsmartupload组件上载中文名称文件,服务器端文件乱码,
文件不能显示和下载。 我想通过汉化Rh7.1来解决问题,但担心:
汉化后,oracle,apache,tomcat还能不能正常启动?
通过jspsmartupload组件上载中文名称文件,服务器端文件乱码,
文件不能显示和下载。 我想通过汉化Rh7.1来解决问题,但担心:
汉化后,oracle,apache,tomcat还能不能正常启动?
|
//试试下面的每个方法,转换得到的参数!
public static String iso8859togbk(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String iso8859togb2312(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859_1"), "gb2312");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String gb2312to8859(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("gb2312"), "ISO8859_1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String gbkto8859(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("gbk"), "ISO8859_1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String iso8859togbk(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String iso8859togb2312(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("ISO8859_1"), "gb2312");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String gb2312to8859(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("gb2312"), "ISO8859_1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
public static String gbkto8859(String strvalue)
{
try{
if(strvalue==null)
return null;
else
{
strvalue = new String(strvalue.getBytes("gbk"), "ISO8859_1");
return strvalue;
}
}catch(Exception e){
return null;
}
}
|
你或者可以试一下将String oldname = new String(name.getBytes("ISO8859_1"), "gb2312"); 后面的gb2312去掉,有没有试过这样??
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。