• Resolved AliceWonderFull

    (@alicewonderfull)


    Does WordPress already have the facilities for switching between punycode and IDNA?

    http://www.phpclasses.org/browse/file/5845.html

    is a pretty good class I have used in the past, I am hesitant to include it with my plugin especially if the issue is already addressed in WordPress, but also because if the issue is not addressed then I would rather advocate for the issue being officially addressed. Maybe even by including that class (it is GPL2.1)

Viewing 1 replies (of 1 total)
  • Thread Starter AliceWonderFull

    (@alicewonderfull)

    Resolved, with the appropriate version of php this can be done with PECL modules.

    function smartAvaIDN2Puny($domain) {
    	if(function_exists('idn_to_ascii')) {
    		$domain=idn_to_ascii($domain);
    		}
    	return($domain);
    	}
    
    function smartAvaPuny2IDN($domain) {
    	if(function_exists('idn_to_utf8')) {
    		$domain=idn_to_utf8($domain);
    		}
    	return($domain);
    	}

    works for me. Well, the PECL modules (idn and intl) have some known bugs that cause certain IDNs not to work but those will get fixed and using binary PECL modules is probably a better solution than using the class.

Viewing 1 replies (of 1 total)

The topic ‘punycode / IDNA converter’ is closed to new replies.