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

  • Home
  • SEARCH
  • 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 4558852
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:42:23+00:00 2026-05-21T17:42:23+00:00

Is there a way to achieve transliteration of characters between charsets in java? something

  • 0

Is there a way to achieve transliteration of characters between charsets in java? something similar to the unix command (or similar php function):

iconv -f UTF-8 -t ASCII//TRANSLIT < some_doc.txt  > new_doc.txt

preferably operating on strings, not having anything to do with files

I know you can can change encodings with the String constructor, but that doesn’t handle transliteration of characters that aren’t in the resulting charset.

  • 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-05-21T17:42:24+00:00Added an answer on May 21, 2026 at 5:42 pm

    I’m not aware of any libraries that do exactly what iconv purports to do (which doesn’t seem very well defined). However, you can use “normalization” in Java to do things like remove accents from characters. This process is well defined by Unicode standards.

    I think NFKD (compatibility decomposition) followed by a filtering of non-ASCII characters might get you close to what you want. Obviously, this is a lossy process; you can never recover all of the information that was in the original string, so be careful.

    /* Decompose original "accented" string to basic characters. */
    String decomposed = Normalizer.normalize(accented, Normalizer.Form.NFKD);
    /* Build a new String with only ASCII characters. */
    StringBuilder buf = new StringBuilder();
    for (int idx = 0; idx < decomposed.length(); ++idx) {
      char ch = decomposed.charAt(idx);
      if (ch < 128)
        buf.append(ch);
    }
    String filtered = buf.toString();
    

    With the filtering used here, you might render some strings unreadable. For example, a string of Chinese characters would be filtered away completely because none of them have an ASCII representation (this is more like iconv’s //IGNORE).

    Overall, it would be safer to build your own lookup table of valid character substitutions, or at least of combining characters (accents and things) that are safe to strip. The best solution depends on the range of input characters you expect to handle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to achieve function overloading in C? I am looking at
Is there a way to achieve the following? In my /www/var/public_html/index.php file i have
Is there any way to achieve the master page concept of ASP.NET in PHP?
Is there an easier way to achieve the following? var obj = from row
Is there any way to achieve this? I am using a pagination plugin that
Is there a way to achieve a blurry or glowing effect for the text?
Purpose and craziness aside, is there a way to achieve this in C++? template
Greetings, Is there any way to create something like automatic combobox switcher in WPF?
Is there way in next piece of code to only get the first record?
is there way thats i can preselect an item when the page loads or

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.