Exemplo n.º 1
0
 /**
  * Get whether iconv extension is available
  *
  * @return boolean
  */
 public static function getIsIconvEnabled()
 {
     if (isset(self::$_isIconvEnabled)) {
         return self::$_isIconvEnabled;
     }
     self::$_isIconvEnabled = function_exists('iconv') ? true : false;
     return self::$_isIconvEnabled;
 }
Exemplo n.º 2
0
 /**
  * Get whether iconv extension is available
  *
  * @return boolean
  */
 public static function getIsIconvEnabled()
 {
     if (isset(self::$_isIconvEnabled)) {
         return self::$_isIconvEnabled;
     }
     // Fail if iconv doesn't exist
     if (!function_exists('iconv')) {
         self::$_isIconvEnabled = false;
         return false;
     }
     // Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
     if (!@iconv('UTF-8', 'UTF-16LE', 'x')) {
         self::$_isIconvEnabled = false;
         return false;
     }
     // Sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
     // we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
     if (!@iconv_substr('A', 0, 1, 'UTF-8')) {
         self::$_isIconvEnabled = false;
         return false;
     }
     // CUSTOM: IBM AIX iconv() does not work
     if (defined('PHP_OS') && @stristr(PHP_OS, 'AIX') && defined('ICONV_IMPL') && @strcasecmp(ICONV_IMPL, 'unknown') == 0 && defined('ICONV_VERSION') && @strcasecmp(ICONV_VERSION, 'unknown') == 0) {
         self::$_isIconvEnabled = false;
         return false;
     }
     // If we reach here no problems were detected with iconv
     self::$_isIconvEnabled = true;
     return true;
 }
Exemplo n.º 3
0
 /**
  * Get whether iconv extension is available
  *
  * @return boolean
  */
 public static function getIsIconvEnabled()
 {
     if (isset(self::$_isIconvEnabled)) {
         return self::$_isIconvEnabled;
     }
     // Check that iconv exists
     // Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
     // we cannot use iconv when that happens
     // Also, sometimes iconv_substr('A', 0, 1, 'UTF-8') just returns false in PHP 5.2.0
     // we cannot use iconv in that case either (http://bugs.php.net/bug.php?id=37773)
     if (function_exists('iconv') && @iconv('UTF-8', 'UTF-16LE', 'x') && @iconv_substr('A', 0, 1, 'UTF-8')) {
         self::$_isIconvEnabled = true;
     } else {
         self::$_isIconvEnabled = false;
     }
     return self::$_isIconvEnabled;
 }
Exemplo n.º 4
0
 /**
  * Get whether iconv extension is available
  *
  * @return boolean
  */
 public static function getIsIconvEnabled()
 {
     if (isset(self::$_isIconvEnabled)) {
         return self::$_isIconvEnabled;
     }
     // Check that iconv exists
     // Sometimes iconv is not working, and e.g. iconv('UTF-8', 'UTF-16LE', 'x') just returns false,
     // we cannot use iconv when that happens
     if (function_exists('iconv') && @iconv('UTF-8', 'UTF-16LE', 'x')) {
         self::$_isIconvEnabled = true;
     } else {
         self::$_isIconvEnabled = false;
     }
     return self::$_isIconvEnabled;
 }
 /**
  * Get whether iconv extension is available
  *
  * @return boolean
  */
 public static function getIsIconvEnabled()
 {
     if (isset(self::$_isIconvEnabled)) {
         return self::$_isIconvEnabled;
     }
     // IBM AIX iconv() does not work
     self::$_isIconvEnabled = function_exists('iconv') && !(defined('PHP_OS') && @stristr(PHP_OS, 'AIX') && defined('ICONV_IMPL') && @strcasecmp(ICONV_IMPL, 'unknown') == 0 && defined('ICONV_VERSION') && @strcasecmp(ICONV_VERSION, 'unknown') == 0) ? true : false;
     return self::$_isIconvEnabled;
 }