用string的编码方式进行转化应该可以吧。

解决方案 »

  1.   

    .  .- .-
                                                            ./    .--...
                                                  .-------- 0    .--
                                                 /                 .......
                                                '                  ..
                                                 '........            ----
                                                          .          --..
                                                           .   .---..   -
                                       分  o               .  '     -.
                                         分               /   '
                                                         / ' ' '
                                       \-分--/....... . '  ' '  '
                                        \ __/ -      - -'  '  ' '
                                                        '  '  ' '
                                         o              '   ' ' '
                                                        '   '  '
                                                         -..'.----------.
                                                            I   ----------
                                                     /////////.
      

  2.   

    我从中文拷贝一个内容是中文的记事本文件到日文系统,然后用
    package test;import java.io.*;public class CodingTest {
      public CodingTest() {
      }  public static void write(String fromEncoding, String toEncoding) throws
          Exception {
        FileInputStream fin = new FileInputStream("c:/a.txt");
        BufferedReader in = new BufferedReader(new InputStreamReader(fin,
            fromEncoding));
        FileOutputStream fout = new FileOutputStream("c:/aa.txt");
        BufferedWriter out = new BufferedWriter(new OutputStreamWriter(fout,
            toEncoding));    String str;    while ( (str = in.readLine()) != null) {
          out.write(str, 0, str.length());
          out.newLine();
          out.flush();    }
      }  public static void main(String args[]) throws Exception {
         write("GB2312", "UTF8");
    //    write("GB2312", "MS932");
      }
    }
    用这个程序读出写入到aa.txt中,发现有部分是乱码。部分不是乱码。不是乱码的是日文系统,中文系统中都存在的字,不存在的为?号。