try {
          descFile = new RandomAccessFile(this.filePath, "rw");
          while(descFile.getFilePointer() < descFile.length()){
            String a = descFile.readLine();  \\这个字符串是乱码啊?
          }
        }
        catch (Exception ex) {
        }多谢!

解决方案 »

  1.   

    楼上说的对,需要一致才行。但一般可以这样:把sun 的src.zip文件中的Properties.java 解压开
    然后可发现里面有两个私有方法saveConvert(),loadConvert()你把这两个方法拷贝到你的类中.
    然后如下调用就可以了(如你上面的
    String a = descFile.readLine();  \\这个字符串是乱码啊?
    String strTempCovert = saveConvert(a,true);//第二个参数是表示是否忽略一些俄控制字符
    a = loadConvert(strTempConvert);
    具体可以看注解
    /*
         * Converts unicodes to encoded &#92;uxxxx
         * and writes out any of the characters in specialSaveChars
         * with a preceding slash
         */
        private String saveConvert(String theString, boolean escapeSpace)     /*
         * Converts encoded &#92;uxxxx to unicode chars
         * and changes special saved chars to their original forms
         */
        private String loadConvert(String theString)
    其实这个也就是,为什么java中用Properties存储文件都变成了 
    中文  会变成     \u6143\u232A 等字样的原因
      

  2.   

    /*
     * 1行づつ読込
     */
    while (null != (str = dataInStream.readLine())) { row++; str = new String(str.getBytes("iso-8859-1"), "Shift_JIS");
    试一下这个