Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7909233
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T12:19:27+00:00 2026-06-03T12:19:27+00:00

I need to remove diacritics from uppercase characters in a string. Example : Électronique

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T12:19:30+00:00Added an answer on June 3, 2026 at 12:19 pm

    Try this instead:

    public static String removeDiacriticsFromUppercaseLetters(String input) 
    { 
        if (input == null) 
            return null; 
    
        String normalized = Normalizer.normalize(input, Normalizer.Form.NFD); 
    
        StringBuilder newString = new StringBuilder(); 
        boolean checkDiacritics = false;
    
        for (int i = 0; i < normalized.length(); ++i) 
        { 
            char ch = normalized.charAt(i);
    
            if (checkDiacritics)
            {
                if (Character.getType(ch) == Character.NON_SPACING_MARK)
                    continue;
    
                checkDiacritics = false;
            }
    
            if (Character.isUpperCase(ch))
                checkDiacritics = true;
    
            newString.append(ch); 
        } 
    
        //return newString.toString(); 
        return Normalizer.normalize(newString.toString(), Normalizer.Form.NFC); 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to remove the following format from the end of a string in
I need to remove all characters from a string which aren't in a-z A-Z
I need to remove commas within a String only when enclosed by quotes. example:
I need to remove the following script from my page(ASP.NET 3.5), leaving all other
I need to remove these ' & ' characters from each property of a
From text: Text... Target row Text... I need remove row with string ' Target
I need to remove duplicate words from a string. How would I go about
I need to remove trailing dot from my domain name. I have example below.
I need to remove trailing decimal/dot from a statement. Following is the statement ABC
Possible Duplicate: How do I remove diacritics (accents) from a string in .NET? I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.