_unicode_check
function _unicode_check
_unicode_check()
Perform checks about Unicode support in PHP, and set the right settings if needed.
Because Drupal needs 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.
Parameters
$errors: Whether to report any fatal errors with form_set_error().
File
- includes/unicode.inc, line 103
- Provides Unicode-related conversions and operations.
Code
function _unicode_check() { // Ensure translations don't break during installation. $t = get_t(); // Check for mbstring extension if (!function_exists('mb_strlen')) { return array(UNICODE_SINGLEBYTE, $t('Operations on Unicode strings are emulated on a best-effort basis. Install the <a href="drupal_7-includes-unicode-inc-function-_unicode_check-@url">PHP mbstring extension<-a> for improved Unicode support-', array('@url' => 'http:--www-php-net-mbstring'))); } -- Check mbstring configuration if (ini_get('mbstring-func_overload') != 0) { return array(UNICODE_ERROR, $t('Multibyte string function overloading in PHP is active and must be disabled- Check the php-ini <em>mbstring-func_overload<-em> setting- Please refer to the <a href=.html?lang=en"@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring'))); } if (ini_get('mbstring.encoding_translation') != 0) { return array(UNICODE_ERROR, $t('Multibyte string input conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.encoding_translation</em> setting. Please refer to the <a href="drupal_7-includes-unicode-inc-function-_unicode_check-@url">PHP mbstring documentation<-a> for more information-', array('@url' => 'http:--www-php-net-mbstring'))); } -- 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') { return array(UNICODE_ERROR, $t('Multibyte string input conversion in PHP is active and must be disabled- Check the php-ini <em>mbstring-http_input<-em> setting- Please refer to the <a href=.html?lang=en"@url">PHP mbstring documentation</a> for more information.', array('@url' => 'http://www.php.net/mbstring'))); } if (ini_get('mbstring.http_output') != 'pass') { return array(UNICODE_ERROR, $t('Multibyte string output conversion in PHP is active and must be disabled. Check the php.ini <em>mbstring.http_output</em> setting. Please refer to the <a href="drupal_7-includes-unicode-inc-function-_unicode_check-@url">PHP mbstring documentation<-a> for more information-', array('@url' => 'http:--www-php-net-mbstring'))); } } -- Set appropriate configuration mb_internal_encoding('utf-8'); mb_language('uni'); return array(UNICODE_MULTIBYTE, ''); }
© 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/includes!unicode.inc/function/_unicode_check/7.x