0

I'm trying to get data from a text file, that was generated by ArcGIS, to clean it up using regex. When I launch application by using RUN PROJECT, everything works, but when I launch the .jar file, it adds "Ā" symbol into the data. Using NetBeans, JDK7, project encoding is set to UTF-8.

Here's the original string:

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"

The program reads it like this (I replaced the middle part of the string with (===), it is unchanged):

0,RIX_P_1,AREA,2,(===),"23° 57' 51,805"" E","56° 53' 30,142"" N"

Here's the button code that does the reading job. It is partially taken from a tutorial:

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.");
        }        
    }

I found some information on the WEB it seems that problem is in encoding, but I cannot figure out, how to setup things correctly.

P.S. I'm a novice in programming, so excuse me for stupid questions :)

Zmur
  • 322
  • 6
  • 24

1 Answers1

0

Although you have solved your problem, I suggest taking a look at Scanner class. It's much easier to use than all the Reader classes you are using.

mundomug
  • 132
  • 2
  • 11