(Perhaps use Scanner.nextLine() .)
import java.text.Normalizer; import java.text.Normalizer.Form; String ascii = Normalizer.normalize(myChars, Form.NFKD) .replaceAll("\\P{ASCII}", "");
This divides all accented characters, such as ĉ , into c and zero length ^ . And then all non-ascii (capital P = non-P) are deleted.
source share