I'm having a problem reading a file and need to remove the accents from the string, but the function is not working in my JavaFX application.
Function:
public static String remove(String str) {
return Normalizer.normalize(str, Normalizer.Form.NFKD).replaceAll("[^\p{ASCII}]", "");
}
In a Java application this function works perfectly, only in my application JavaFX does not work. In my application it is removing the letter. for example: I pass the word "management" and it returns me gesture. Since in the Java application it works normally. In both applications the function calls are identical.
@edit
I was able to solve the problem, it was the encoding of the file. Now it's working perfectly. I just changed the line that reads.
buffer = new BufferedReader(new InputStreamReader(new FileInputStream(caminho), Charset.forName("ISO-8859-1")));