if ((!isset($opts['idn']) || !$opts['idn']) &&
(stripos($host, 'xn--') === 0) &&
Horde_Util::extensionExists('idn')) {
- $host = Horde_String::convertCharset(idn_to_utf8($host), 'UTF-8');
+ if (function_exists('idn_to_utf8')) {
+ $host = idn_to_utf8($host);
+ } elseif (function_exists('idn_punycode_decode')) {
+ $host = idn_punycode_decode($host);
+ }
+ $host = Horde_String::convertCharset($host, 'UTF-8');
}
$address .= self::encode($mailbox, 'address') . '@' . $host;
// Convert IDN hosts to ASCII.
if (Horde_Util::extensionExists('idn')) {
$old_error = error_reporting(0);
- $host = idn_to_ascii(Horde_String::convertCharset($host, $GLOBALS['registry']->getCharset(), 'UTF-8'));
+ $host = Horde_String::convertCharset($host, $GLOBALS['registry']->getCharset(), 'UTF-8');
+ if (function_exists('idn_to_ascii')) {
+ $host = idn_to_ascii($host);
+ } elseif (function_exists('idn_punycode_encode')) {
+ $host = idn_punycode_encode($host);
+ }
error_reporting($old_error);
} elseif (Horde_Mime::is8bit($ob['mailbox'], $GLOBALS['registry']->getCharset())) {
throw new IMP_Compose_Exception(sprintf(_("Invalid character in e-mail address: %s."), $email));
// Convert IDN hosts to ASCII.
if (Horde_Util::extensionExists('idn')) {
$old_error = error_reporting(0);
- $url['host'] = idn_to_ascii(Horde_String::convertCharset($url['host'], $GLOBALS['registry']->getCharset(), 'UTF-8'));
+ $url['host'] = Horde_String::convertCharset($url['host'], $GLOBALS['registry']->getCharset(), 'UTF-8');
+ if (function_exists('idn_to_ascii')) {
+ $url['host'] = idn_to_ascii($url['host']);
+ } elseif (function_exists('idn_punycode_encode')) {
+ $url['host'] = idn_punycode_encode($url['host']);
+ }
error_reporting($old_error);
} elseif (Horde_Mime::is8bit($url['host'])) {
//throw new Kronolith_Exception(_("Invalid character in URL."));