这个很简单的,用下面的构造函数就可以了:
InputStreamReader(InputStream in, CharsetDecoder dec) 
Create an InputStreamReader that uses the given charset decoder.
具体的看Java的Doc吧。

解决方案 »

  1.   


    以下是我写的类,应该很容易看董,UnicodeToChinese()方法和,ChineseToUnicode()实现了你的要求。package com.db;import java.lang.*;
    import java.util.*;
    import java.lang.Integer;
    import java.sql.*;public class CharCode{public static String UnicodeToChinese(String s){ 
    try{ 
    if(s==null||s.equals("")) return ""; 
    String newstring=null; 
    newstring=new String(s.getBytes("ISO8859_1"),"gb2312"); 
    return newstring; 

    catch(Exception e) 

    return s; 

    } public static String ChineseToUnicode(String s){ 
    try{ 
    if(s==null||s.equals("")) return ""; 
    String newstring=null; 
    newstring=new String(s.getBytes("gb2312"),"ISO8859_1"); 
    return newstring; 

    catch(Exception e) 

    return s; 


    }
      

  2.   

    public static String gb2big(String s)
        {
            try{
                if(s==null || s.equals("")) return "";
                String newstring = null;
                newstring = new String(s.getBytes("gb2312"),"big5");
                return newstring;
            }
            catch(Exception e)
            {
                return "";
            }
        }
    简体--〉繁体
      

  3.   

    newstring = new String(s.getBytes("gb2312"),"big5");
    这样就完成了GB码向BIG码的转化?
    试都不用试的啊,
    用脚趾头想就知道不可以的啊,
    说要你们试还生气,
    GB码和BIG码对应的Unicode码肯定是不一样啊,
    要不怎么是Unicode码,
    那样就肯定转不正确啊.
      

  4.   

    支持  oicu (阿猫)  
    很简单的一个原因:
    “国”字:
    GB码和BIG码对应的Unicode根本不是同一个,
    所以真正的GB码转化成BIG码,需要找到“国”字的Unicode,以及“國”字的Unicode,然后替换...
      

  5.   

    To CAYU:
    Thanks,I'll search the solution and list it here.