我在UNIX系统上 读取文件中文乱码问题

解决方案 »

  1.   

    UNIX默认的本地机编码是GBK之类的?
    如果你的程序再windows下没乱码 就考虑下是不是环境问题 否则就看看你代码是否有问题是否需要转码
      

  2.   

    我用String enc = System.getProperty("file.encoding");       System.out.println("===="+enc);
    在服务器(unix)输出后 是 ISO8859-1 
    我本地(windows 操作系统)是 GBK 
    不知道怎样才能解决
      

  3.   

    转码不就可以了?
    Unix-->Win
    String win=new String(unix.getBytes("ISO8859-1"),"GBK");
    Win-->Unix
    String unix=new String(win.getBytes("GBK"),"ISO8859-1");
      

  4.   

    private void OutputXML(Document docXML, File strFilename) {    
       XMLOutputter fmt = new XMLOutputter();
        try {   
          //输出文件对象
         Format format = Format.getPrettyFormat();         format.setEncoding("GBK"); 
            
         fmt.setFormat(format);
         fmt.output(docXML, System.out);//这里输出中文
          FileWriter fwXML = new FileWriter(strFilename);          fmt.output(docXML, fwXML);  //变??
         
          fwXML.close();
         
        }catch (Exception e) {
          e.printStackTrace();
        }
    }    求救
      

  5.   

    你的Format类和XMLOutputter类是哪个包里的?怎么方法和我见到的不一样呀!?
    如果你用jdom,可以直接读iso8859的XML文件,不用转码了