Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1503139
  • 博文数量: 3500
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 43870
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-03 20:31
文章分类

全部博文(3500)

文章存档

2008年(3500)

我的朋友

分类:

2008-05-04 20:07:45

一起学习
对此问题的解决办法之一是写一个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 ; } } } 下载本文示例代码


参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题参数传递过程中的中文问题
阅读(117) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~