String Handling - Javafx Application

Asked

Viewed 93 times

0

I’m having a problem I’m reading a file and I need to remove the accents of the string, however, 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 Javafx application it 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. 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")));
  • I tested it in a Javafx application and it worked. Can I give you more details or a playable example? Tried it with str.replaceAll("\\p{M}", "")?

  • I tested and it didn’t work in my Javafx application in the other application worked. What I’m doing is I’m reading a csv file and I’m playing it for a split vector. From there I take the string that is in a vector position and game for a variable and put in my sql string.

  • @iMakaay Please publish the solution as a response.

1 answer

0

Problem solved

buffer = new BufferedReader(new InputStreamReader(new FileInputStream(caminho), Charset.forName("ISO-8859-1")));

Browser other questions tagged

You are not signed in. Login or sign up in order to post.