I am trying to convert Unicode string to Ascii in Java. I have come up with the following code:
I want to convert all possible text + operators + apostrophe (similar characters as well).
How can I achieve such result?
What is the maximum number of characters I can convert from Unicode to Ascii?
String normalized = Normalizer.normalize(unicodeStr, Normalizer.Form.NFD);
String asciiStr = normalized.replaceAll("[^\p{ASCII}-']");
I tried this, but mathematical operators and apostrophe did not get converted.
Apollyon is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.