Macros

给我一支烟!请所有烦恼都能过往如云烟!

导航

转换String的编码格式为GBK

public String changeCharset(String input){
  String temp="";
  try{
   //去除输入字符串首尾的空格
   temp=input.trim();
   //进行编码转换
   temp=new String(temp.getBytes("ISO8859_1"),"GBK");
  }catch(Exception e){
   e.printStackTrace();
   temp = "编码转换错误!";
  }
  return temp;
 }

posted on 2005-08-29 18:32  Macros  阅读(1490)  评论(0)    收藏  举报