I encounter an issue with converting domain names which contains the german Eszett "ß", usually I use the java IDN class to do it, but it does not work as expected on this specific case.
String domainName = "faß.de";
String expectedAsciiDomainName = "xn--fa-hia.de";
if (expectedAsciiDomainName.equals(IDN.toASCII(domainName))) {
System.out.println("Cool");
} else {
System.out.println("Not cool");
}
Any ideas of why it does not work ? thanks
I've seen that in PHP there is an option for nontransitional processing of IDN conversion which works perfectly :
echo idn_to_ascii('faß.de', IDNA_NONTRANSITIONAL_TO_ASCII) . PHP_EOL; // return xn--fa-hia.de
is there a way to do the same thing on java ?
I finally found this library : https://github.com/unicode-org/icu (as java class IDN.toASCII use IDNA2003 instead of IDNA2008) which works perfectly...