Clean port of LGPL libidn2 punycode decoder.
Intended to be a starting point for #11640 (URL's with IDN shows in Punycode).
Unlike the punycode decoder in libs/Zend/Validate/Hostname.php, this decoder:
Might eventually allow removal of libs/Zend/Validate (if someone writes an email address validator). The code point validator in Zend_Validate_Hostname is dubious given the preg_match buffer limit.
Hi @robocoder Thanks for the PR. Is there by any chance an existing PHP package we could reuse for this logic? Maybe in the symfony codebase or so?
Sorry, I don't have the interest/time to integrate 3rd party libs. If anyone is interested, look at https://github.com/arubacao/tld-checker (for the TLD list) and https://github.com/true/php-punycode (to encode/decode PunyCode). I recommend adding a wrapper to use the intl extension functions if available.