Version: libidn-1.9.jar
When calling method IDNA.toASCII() with argument like
"www.google.com." ( dot at the last position. It is correct usage. For
example, Firefox and IE treat this well. ) we get IDNAException:
String too long.
Possible solution:
public static String toASCII(String input) throws IDNAException {
StringBuilder o = new StringBuilder ();
StringBuilder h = new StringBuilder ();
for (int i = 0; i < input.length(); i++) {
char c = input.charAt(i);
if (c == '.' || c == '\u3002' || c == '\uff0e' || c == '\uff61') {
o.append(toASCII(h.toString(), false, true));
o.append(c);
h = new StringBuilder ();
} else {
h.append(c);
}
}
if(h.length() != 0){ //
------------------------------------------------------------- add
this line
o.append(toASCII(h.toString(), false, true));
return o.toString();
}
--
Regards,
Tarasenko Pavel
_______________________________________________
Help-libidn mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-libidn