| 
         
     
     | 
     | 
    
  
    | 
    DisplayTag中文乱码 | 
   
  
     | 
   
  
     | 
   
  
    | 
     作者:未知  来源:月光软件站  加入时间:2005-2-28 月光软件站  | 
   
  
    今天用了下DisplayTag,挺好的一个东西。就是对中文支持有些问题。我在displaytag.properties里修改了一些设置,包含了一些中文,比如 paging.banner.item_name=记录 。显示的时候就出乱码了。把配置文件改成displaytag_zh.properties或者displaytag_zh_CN.properties也不行。配置文件改成UTF-8编码也不行。在网上一时也没找到好的办法。只好下了一份代码,修改 org.displaytag.properties.TableProperties ,把
      private String getProperty(String key)     {       return this.properties.getProperty(key);     }
 
  改成     private String getProperty(String key)     {         String s = null;         try {           s = new String(this.properties.getProperty(key).getBytes("8859_1"), "GBK");         }catch(Exception e) {           s = null;         }       return s;     }
  编译后再一试就可以了。办法实在是龌龊了点儿,先凑和吧。
  我的环境是Windows中文 + SUN JDK 1.42 + Tomcat 5.0.28 + DisplayTag 1.0
 
  
 
  | 
   
  
     | 
   
  
     相关文章:相关软件:  | 
   
   
      |