关于TOMCAT中的中文处理问题的解决方法

当前所使用的jsp服务器中,常用的有resin和tomcat两种,resin对中文的支持比较好,但大部分初学者或者大部分人还是习惯于使用tomcat服务器,这其中就常常遇到中文解决的问题,写了个函数来解决:

String CStr(String str)  
{
 String result  = str;
 if(result==null)   result="";
 try  
 {    
  result =  new  String(result.getBytes("ISO8859_1"),"GB2312");  
 }  
 catch(Exception   e)  
 {  e.printStackTrace(); }
 return result;  
}

来处理tomcat运行的jsp文件传送中文参数的问题。 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章