Finally, I’ve solved it by using the Normalizer
class.
import java.text.Normalizer;
public static String stripAccents(String s)
{
s = Normalizer.normalize(s, Normalizer.Form.NFD);
s = s.replaceAll("[\\p{InCombiningDiacriticalMarks}]", "");
return s;
}
Related Contents:
- Is there a way to get rid of accents and convert a whole string to regular letters?
- Remove diacritical marks (ń ǹ ň ñ ṅ ņ ṇ ṋ ṉ ̈ ɲ ƞ ᶇ ɳ ȵ) from Unicode chars
- Converting Symbols, Accent Letters to English Alphabet
- How can I iterate through the unicode codepoints of a Java String?
- How can I replace non-printable Unicode characters in Java?
- Creating Unicode character from its number
- How to replace � in a string
- Java Array Searching [closed]
- How to get a string present within single quotes in a line using java [closed]
- Splitting a Java String by the pipe symbol using split(“|”)
- Questions about Java’s String pool [duplicate]
- How to add new elements to an array?
- Convert String to double in Java
- How does the String class override the + operator?
- String’s Maximum length in Java – calling length() method
- Java how to replace 2 or more spaces with single space in string and delete leading and trailing spaces
- Difference between String replace() and replaceAll()
- Concatenating null strings in Java [duplicate]
- Is there a way to instantiate a class by name in Java?
- How to generate a random alpha-numeric string
- Java, Calculate the number of days between two dates [duplicate]
- Redirect console output to string in Java
- Where does Java’s String constant pool live, the heap or the stack?
- Convert escaped Unicode character back to actual character
- Get the index of a pattern in a string using regex
- How to use regex in String.contains() method in Java
- Consistency of hashCode() on a Java string
- compareTo() vs. equals()
- Reverse a given sentence in Java
- Extract string between two strings in java
- Java String to SHA1
- Java FileReader encoding issue
- The concatenation of chars to form a string gives different results
- What is the simplest way to convert a Java string from all caps (words separated by underscores) to CamelCase (no word separators)?
- How to check if a string starts with one of several prefixes?
- How can I invert the case of a String in Java?
- Remove all empty lines
- Convert String XML fragment to Document Node in Java
- Java Unicode encoding
- Converting ArrayList of Characters to a String?
- Find the Number of Occurrences of a Substring in a String
- Creating a UUID from a string with no dashes
- Difference between UTF-8 and UTF-16?
- How can I open files containing accents in Java?
- How is String in switch statement more efficient than corresponding if-else statement?
- intern() behaving differently in Java 6 and Java 7
- How does Java store UTF-16 characters in its 16-bit char type?
- String concatenation with Null
- Garbage collection on intern’d strings, String Pool, and perm-space
- UTF-8 text (Hindi) not getting displayed on Browser window or Eclipse console