|
|
@ -124,17 +124,21 @@ public class yacyURL implements Serializable {
|
|
|
|
|
|
|
|
|
|
|
|
// handle international domains
|
|
|
|
// handle international domains
|
|
|
|
if (!Punycode.isBasic(host)) try {
|
|
|
|
if (!Punycode.isBasic(host)) try {
|
|
|
|
final int d1 = host.lastIndexOf('.');
|
|
|
|
final String[] domainParts = host.split("\\.");
|
|
|
|
if (d1 >= 0) {
|
|
|
|
StringBuilder buffer = new StringBuilder();
|
|
|
|
final String tld = host.substring(d1 + 1);
|
|
|
|
// encode each domainpart seperately
|
|
|
|
final String dom = host.substring(0, d1);
|
|
|
|
for(int i=0; i<domainParts.length; i++) {
|
|
|
|
final int d0 = dom.lastIndexOf('.');
|
|
|
|
final String part = domainParts[i];
|
|
|
|
if (d0 >= 0) {
|
|
|
|
if(!Punycode.isBasic(part)) {
|
|
|
|
host = dom.substring(0, d0) + ".xn--" + Punycode.encode(dom.substring(d0 + 1)) + "." + tld;
|
|
|
|
buffer.append("xn--" + Punycode.encode(part));
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
host = "xn--" + Punycode.encode(dom) + "." + tld;
|
|
|
|
buffer.append(part);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(i != domainParts.length-1) {
|
|
|
|
|
|
|
|
buffer.append('.');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
host = buffer.toString();
|
|
|
|
} catch (final PunycodeException e) {}
|
|
|
|
} catch (final PunycodeException e) {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|