I need to remove diacritics from uppercase characters in a string. Example : Électronique Caméras => Electronique Caméras (only the É is modified, é in Caméras remains as it is)
I am using the following method, which removes diacritics only from the uppercase letters, but the reconstructed string looks like this - Electronique Came?ras (é is lost). How can I reconstruct the string properly?
public static String removeDiacriticsFromUppercaseLetters(String input)
    {
        if (input == null)
              return input;
        String normalized= Normalizer.normalize(input, Normalizer.Form.NFD);
        StringBuilder newString = new StringBuilder();
        newString.append(normalized.charAt(0));
        for (int i=1;i<normalized.length();++i)
        {
            //Check if this diacritic is for an uppercase letter, if yes, skip
            if (Character.isUpperCase(normalized= .charAt(i-1)) && Character.getType(normalized.charAt(i)) == Character.NON_SPACING_MARK){
              continue;
            }
            else{
              newString.append(normalized.charAt(i));
            }
        }
        return newString.toString();
    }
Thanks
 
    