Apache Common UrlValidator does not support unicode. alernative is avaliable?

前端 未结 2 728
广开言路
广开言路 2021-01-15 12:53

i try to url validation. but UrlValidator is does not support unicode. here is code

public static boolean isValidHttpUrl(String url) {
    String[] schemes =         


        
2条回答
  •  天涯浪人
    2021-01-15 12:58

    It doesn't support IDN. You need to convert URL to Punycode first. Try this,

      isValid = isValidHttpUrl(IDN.toASCII(url));
    

提交回复
热议问题