csv - Removing space in Java error -
basically, program convert data .csv format. but, faced error such when open file in excel, displays data when in notepad, becomes characters ㈬㥙〳㈬㥙ㄳ㌬かㄹ㌬か㌹㌬ㅋㄳ㌬ㅋ㈳㌬ㅋ㌳㌬ㅋ㐳
here's line of code
string resultstring = stringwriter.tostring(); ( string cheese: pie.keyset() ) { resultstring += system.getproperty("line.separator") + cheese + "," + pie.get(cheese).tostring(); resultstring = resultstring.replaceall(",$" , "").replaceall(" ", ""); } this.writetofile(resultstring);
i have multiple file method remove space file has error. i've tried multiple methods such removing before first resultstring
, @ of pie.get(cheese).tostring()
.
also tried .replace(" ", "");
, replaceall("\\s","")
the data contains special characters. these characters not rendered default encoding. when writing/creating text/csv file, set character encoding utf-8. can in java program itself.
Comments
Post a Comment