Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Converts ASCII URLs to RFC 3490-compatible ponycode URLs.
- * i.e. http://türkçeisimtescil.com/
- * will be converted to http://xn--trkeisimtescil-ijb74a.com
- *
- * @param url
- * @return
- */
- public static String convertUnicodeUrlToPonycode(String url) {
- String separator = "://";
- String protocol = url.substring(0, url.indexOf(separator));
- String rest = url.substring(url.indexOf(separator) + separator.length(), url.length());
- String result = (protocol + separator + IDN.toASCII(rest));
- return result;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement