Advertisement
Guest User

Untitled

a guest
Aug 12th, 2010
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1.         /**
  2.          * Converts ASCII URLs to RFC 3490-compatible ponycode URLs.
  3.          * i.e. http://türkçeisimtescil.com/
  4.          * will be converted to http://xn--trkeisimtescil-ijb74a.com
  5.          *
  6.          * @param url
  7.          * @return
  8.          */
  9.         public static String convertUnicodeUrlToPonycode(String url) {
  10.             String separator = "://";
  11.             String protocol = url.substring(0, url.indexOf(separator));
  12.             String rest = url.substring(url.indexOf(separator) + separator.length(), url.length());
  13.             String result = (protocol + separator + IDN.toASCII(rest));
  14.             return result;
  15.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement