我正在尝试从ArcGIS生成的文本文件中获取数据,以使用正则表达式进行清理。 当我使用RUN PROJECT启动应用程序时,一切正常,但是当我启动.jar文件时,它会在数据中添加“”符号。 使用NetBeans JDK7,项目编码设置为UTF-8。
这是原始字符串:
0,RIX_P_1,AREA,2,LGS,WGS84,TREE,32.3, , , ,25,0.61,M,90%,0.01, ,0.15,90%,0.1,EGM96,ESSENTIAL,08.11.2013,M, , ,NIL,NIL,METRUM,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0,0,0,0,0,0,1,0,0, , , , , , , , , , , ,tree,**"23° 57' 51,805"" E","56° 53' 30,142"" N"
程序读取它(我用(===)替换了字符串的中间部分,它没有改变):
0,RIX_P_1,AREA,2,(===),"23Ā° 57' 51,805"" E","56Ā° 53' 30,142"" N"
这是执行阅读工作的按钮代码。它部分取自教程:
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {
int returnVal = fileChooser.showOpenDialog(this);
if (returnVal == JFileChooser.APPROVE_OPTION) {
File file = fileChooser.getSelectedFile();
try {
FileInputStream fis = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(fis));
jTextArea1.read( br, null );
} catch (IOException ex) {
System.out.println("problem accessing file"+file.getAbsolutePath());
}
} else {
System.out.println("File access cancelled by user.");
}
}
我在WEB上发现了一些信息似乎问题在于编码,但我无法弄清楚,如何正确设置。
P.S。我是编程的新手,请原谅我提出的愚蠢问题:)