Facebook Connect

Connect with Facebook

Nube de Tags

Inicio de sesión

htmlspecialchars() error de caracteres

I am using Drupal 6.20 (it was the same with D 6.19 too).
I got rid of "htmlspecialchars(): Invalid multibyte sequence in argument in /PATH/includes/bootstrap.inc on line 857" warning by replacing check_plain function with the same function from Drupal 6.16 bootstrap.inc file.

Respectively, I replaced this


function check_plain($text) {
  static $php525;

  if (!isset($php525)) {
    $php525 = version_compare(PHP_VERSION, '5.2.5', '>=');
  }
  if ($php525) {
    return htmlspecialchars($text, ENT_QUOTES, 'UTF-8');
  }
  return (preg_match('/^./us', $text) == 1) ? htmlspecialchars($text, ENT_QUOTES, 'UTF-8') : '';
}

with this

function check_plain($text) {
  return drupal_validate_utf8($text) ? htmlspecialchars($text, ENT_QUOTES) : '';
}

Don't know how good it is to do it like this, but seems that it has worked fine.

 

fuente: http://drupal.org/node/894880