Filter charactere From a string

hello

Someone can give me a hand, I have a problem, I hava to return my school project …

I’m using POI Library to extract text from a Word file .but in output i have some bad caracteres …

I how can to filter them or take only the text without there characters when

I write the string in a txtfile…(.txt)

Thanks

Bad character mean the invalid charset? If yes, you can try to use the different constructor of String class.
String utfString = new String(bytes[], “UTF-8”);

If you only want to filter some text, regular expression maybe a good choice for that