function unicode_check

Checks for Unicode support in PHP and sets the proper settings if possible.

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.

Return value

string A string identifier of a failed multibyte extension check, if any. Otherwise, an empty string.

3 calls to unicode_check()
drupal_environment_initialize in drupal/core/includes/bootstrap.inc
Initializes the PHP environment.
unicode_requirements in drupal/core/includes/unicode.inc
Return Unicode library status and errors.
_drupal_maintenance_theme in drupal/core/includes/theme.maintenance.inc
Sets up the theming system for maintenance page.

File

drupal/core/includes/bootstrap.inc, line 693
Functions that need to be loaded on every Drupal request.

Code

function unicode_check() {
  global $multibyte;

  // Check for mbstring extension.
  if (!function_exists('mb_strlen')) {
    $multibyte = UNICODE_SINGLEBYTE;
    return 'mb_strlen';
  }

  // Check mbstring configuration.
  if (ini_get('mbstring.func_overload') != 0) {
    $multibyte = UNICODE_ERROR;
    return 'mbstring.func_overload';
  }
  if (ini_get('mbstring.encoding_translation') != 0) {
    $multibyte = UNICODE_ERROR;
    return 'mbstring.encoding_translation';
  }
  if (ini_get('mbstring.http_input') != 'pass') {
    $multibyte = UNICODE_ERROR;
    return 'mbstring.http_input';
  }
  if (ini_get('mbstring.http_output') != 'pass') {
    $multibyte = UNICODE_ERROR;
    return 'mbstring.http_output';
  }

  // Set appropriate configuration.
  mb_internal_encoding('utf-8');
  mb_language('uni');
  $multibyte = UNICODE_MULTIBYTE;
  return '';
}