Is it possible to get metaphones for those non-english characters?

124 views Asked by At

In java is it possible to convert non-english characters into their english characters.

For example, I want:

Zdeborová --> Zdeborova    
Krząkała  --> Krzakala   
Sr´amek   --> Sramek

so on..

When i try the methods below

        String t1 = Normalizer.normalize("Krząkała", Normalizer.Form.NFD);
        String t2 = t1.replaceAll("[^\\p{ASCII}]", "");
        String t3 = t2.replaceAll("\\p{M}", "");

OR

String t4 = org.apache.commons.lang3.StringUtils.stripAccents("Krząkała");

They all give Krz?ka?a as a result?

I can do this process in oracle sql simly saying :

select 
REGEXP_REPLACE(replace(convert(trim(upper('Krząkała')), 'us7ascii'), '_', ' '), '[^A-Z ]', '') std

from dual;

and get KRZAKALA.

I think in java it must also so simple???

0

There are 0 answers