现在做一个软件,其中有关于从文件中读取彝文并程序在SWT中显示的功能,现在从文件读取后显示是乱码,请高手指教一下,十分感谢!!!

解决方案 »

  1.   

    你读的时候就用utf8格式就可以了
      

  2.   

    应当是前后的编码格式有问题,你输出的时候以utf8格式输出
      

  3.   

    File f = new File("E:\\t.txt");      
    InputStreamReader read = new InputStreamReader(new FileInputStream(f));      
    BufferedReader reader = new BufferedReader(read);      
    String line = null;
    while ((line = reader.readLine()) != null){      
        if("".equals(line)) {      
            continue;      
        } 
          String   localEncode   =   System.getProperty("file.encoding");   
          line   =   new   String(line.getBytes(localEncode),   "utf-8");   
          System.out.println(line);
    }
    }其中t.txt中的内容是彝文,我想应该不是编码的问题吧,这些彝文以前没有处理过,不知道怎么在SWT中显示 。
      

  4.   

    对了,默认的编码是GB18030,对于2楼的方法,我在读的时候用utf-8显示出的也是乱码,?1?7?1?7}?1?7?1?7?3?0?1?7?1?7K?1?7y?1?7%?1?7,请高手指教下。