java unwanted symbols after reading from file -
this question has answer here:
- reading inputstream utf-8 2 answers
i'm trying data text file, generated arcgis, clean using regex. when launch application using run project, works, when launch .jar file, adds "Ā" symbol data. using netbeans, jdk7, project encoding set utf-8.
here's 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 (i replaced middle part of string (===), unchanged):
0,rix_p_1,area,2,(===),"23Ā° 57' 51,805"" e","56Ā° 53' 30,142"" n"
here's button code reading job. partially taken 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 user."); } }
i found information on web seems problem in encoding, cannot figure out, how setup things correctly.
p.s. i'm novice in programming, excuse me stupid questions :)
although have solved problem, suggest taking @ scanner class. it's easier use reader classes using.
Comments
Post a Comment