public static function Unicode::check
public static Unicode::check()
Checks for Unicode support in PHP and sets the proper settings if possible.
Because of the need to be able to handle text in various encodings, we do not support mbstring function overloading. HTTP input/output conversion must be disabled for similar reasons.
Return value
string A string identifier of a failed multibyte extension check, if any. Otherwise, an empty string.
File
- core/lib/Drupal/Component/Utility/Unicode.php, line 145
Class
- Unicode
- Provides Unicode-related conversions and operations.
Namespace
Drupal\Component\UtilityCode
public static function check() { // Check for mbstring extension. if (!function_exists('mb_strlen')) { static::$status = static::STATUS_SINGLEBYTE; return 'mb_strlen'; } // Check mbstring configuration. if (ini_get('mbstring.func_overload') != 0) { static::$status = static::STATUS_ERROR; return 'mbstring.func_overload'; } if (ini_get('mbstring.encoding_translation') != 0) { static::$status = static::STATUS_ERROR; return 'mbstring.encoding_translation'; } // mbstring.http_input and mbstring.http_output are deprecated and empty by // default in PHP 5.6. if (version_compare(PHP_VERSION, '5.6.0') == -1) { if (ini_get('mbstring.http_input') != 'pass') { static::$status = static::STATUS_ERROR; return 'mbstring.http_input'; } if (ini_get('mbstring.http_output') != 'pass') { static::$status = static::STATUS_ERROR; return 'mbstring.http_output'; } } // Set appropriate configuration. mb_internal_encoding('utf-8'); mb_language('uni'); static::$status = static::STATUS_MULTIBYTE; return ''; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Utility!Unicode.php/function/Unicode::check/8.1.x