参数传递过程中的中文问题

对此问题的解决办法之一是写一个bean,好处是可重用。 public class ISOtoGBK { public static String convert( String str ) { if (str.trim()=="") { return null; } try { /*Encodes this String into a sequence of bytes using the named charset, storing the result into a new byte array.*/ byte[] bytesStr=str.getBytes( "ISO-8859-1" ) ; /*Constructs a new String by decoding the specified array of bytes using the specified charset. The length of the new String is a function of the charset, and hence may not be equal to the length of the byte array. */ return new String( bytesStr, "GBK" ) ; } catch( Exception ex ) { return str ; } } } <淘宝热门商品:
 

118.00 元 

韩国正品intercrew LED表 真皮皮带款

 

 

纤体·丽颜New Concept茶坊 纯天然美容瘦身品位花饮


来源:程序员网

小小豆叮

0 Responses to "参数传递过程中的中文问题"

发表评论