读取本地的txt文件里的中文信息就不会乱码,如果读取MF(打成JAR包后解压出来的META-INF文件里的一个文件)格式的文件就会乱码!public static void readFileByLines(String fileName) {
        File file = new File("./swatch/META-INF/MANIFEST.MF");
        BufferedReader reader = null;
        try {
            System.out.println("以行为单位读取文件内容,一次读一整行:");
            reader = new BufferedReader(new FileReader(file));
            String tempString = null;
     
            // 一次读入一行,直到读入null为文件结束
            while ((tempString = reader.readLine()) != null) {
                // 显示行号
                System.out.println( tempString);
            
            }
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (reader != null) {
                try {
                    reader.close();
                } catch (IOException e1) {
                }
            }
        }
    }
编译后的结果:
ine 1: Manifest-Version: 1.0
line 2: MIDlet-Vendor: 閽荤煶鎯呬汉1
line 3: MIDlet-Version: 1.0
line 4: MIDlet-Permissions-Opt: javax.microedition.io.Connector.https,javax.mi
line 5:  croedition.io.Connector.file.read,javax.microedition.io.Connector.fil
line 6:  e.write,javax.microedition.io.Connector.socket,javax.microedition.io.
line 7:  Connector.sms,javax.wireless.messaging.sms.receive,javax.microedition
line 8:  .media.control.VideoControl.getSnapshot,javax.microedition.content.Co
line 9:  ntentHandler
line 10: MIDlet-Install-Notify: http://51xs8.com/install.jsp?yld=0
line 11: Created-By: 1.6.0_21 (Sun Microsystems Inc.)
line 12: MIDlet-Info-URL: http://wap.51xs8.com
line 13: MIDlet-Name: 閽荤煶鎯呬汉1
line 14: MIDlet-1: 閽荤煶鎯呬汉1, l.png, Main
line 15: MicroEdition-Configuration: CLDC-1.0
line 16: MIDlet-Icon: /l.png
line 17: MIDlet-Permissions: javax.microedition.io.Connector.http
line 18: MicroEdition-Profile: MIDP-2.0