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