i have a File with some character and i have some entities like & è à now i want to add instead of & & amp; and so on..how i can do that? If i have Oggi è lunedi & domani è mercoledi i want that è is replaced by (& grave;) and & is replaced by (& amp;) I have this code but works only on one identity at a time...
public void genereateFile(String char_speciale, String char_sostituto, String url_scheletro_file, String url_nuovo_file){
try{
BufferedReader rdr = new BufferedReader(new InputStreamReader(new FileInputStream(url_scheletro_file)));
BufferedWriter wrt = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(url_nuovo_file)));
String line=rdr.readLine();
while(line!= null){
line=line.replaceAll(char_speciale, char_sostituto);
wrt.append(line);
wrt.newLine();
line = rdr.readLine();
}
wrt.close();
}catch(Exception e){
e.printStackTrace();
}