You are here

public static function PHPExcel_Shared_String::getIsIconvEnabled in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php \PHPExcel_Shared_String::getIsIconvEnabled()

* Get whether iconv extension is available * *

Return value

boolean

6 calls to PHPExcel_Shared_String::getIsIconvEnabled()
PHPExcel_Shared_String::ConvertEncoding in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php
* Convert string from one encoding to another. First try mbstring, then iconv, finally strlen * *
PHPExcel_Shared_String::CountCharacters in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php
* Get character count. First try mbstring, then iconv, finally strlen * *
PHPExcel_Shared_String::SanitizeUTF8 in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php
* Try to sanitize UTF8, stripping invalid byte sequences. Not perfect. Does not surrogate characters. * *
PHPExcel_Shared_String::Substring in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php
* Get a substring of a UTF-8 encoded string. First try mbstring, then iconv, finally strlen * *
PHPExcel_Shared_String::UTF8toBIFF8UnicodeLong in vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php
* Converts a UTF-8 string into BIFF8 Unicode string data (16-bit string length) * Writes the string using uncompressed notation, no rich text, no Asian phonetics * If mbstring extension is not available, ASCII is assumed, and compressed notation…

... See full list

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Shared/String.php, line 293

Class

PHPExcel_Shared_String
PHPExcel_Shared_String

Code

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;
}