diff --git a/.travis.yml b/.travis.yml index 788840b..ff13ab3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,7 @@ language: php php: - '5.4' + - '5.5' - '5.6' matrix: include: diff --git a/idna.php b/idna.php index 03faa4a..bac2b63 100644 --- a/idna.php +++ b/idna.php @@ -51,6 +51,10 @@ function ordUTF8($c, $index = 0, &$bytes = null) */ function EncodePunycodeIDN( $value ) { + if ( function_exists( 'idn_to_ascii' ) ) { + return idn_to_ascii( $value ); + } + /* search subdomains */ $sub_domain = explode( '.', $value ); if ( count( $sub_domain ) > 1 ) { @@ -189,6 +193,10 @@ function EncodePunycodeIDN( $value ) */ function DecodePunycodeIDN( $value ) { + if ( function_exists( 'idn_to_utf8' ) ) { + return idn_to_utf8( $value ); + } + /* search subdomains */ $sub_domain = explode( '.', $value ); if ( count( $sub_domain ) > 1 ) {