Replace all occurrences "-" with the non-printable character "\ 001", so "Péña" will become "Pé \ 001a". Then call Normalizer.normalize()to expand "é" into "e" and a separate diacritical mark. Finally, remove the diacritics and convert the unprintable character back to "-".
String partiallyNormalize(String string)
{
string = string.replace('ñ', '\001');
string = Normalizer.normalize(string, Normalizer.Form.NFD);
string = string.replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
string = string.replace('\001', 'ñ');
return string;
}
UTF-8 ?, , .