Home

Java cheat sheet

Replace all non UTF-8 characters by an empty string

str.replaceAll("[^\\x20-\\x7e]", "")