warning: htmlspecialchars() [function.htmlspecialchars]: Invalid multibyte sequence in argument in /var/www/html/drupal-6.25/includes/bootstrap.inc on line 860.
warning: htmlspecialchars() [function.htmlspecialchars]: Invalid multibyte sequence in argument in /var/www/html/drupal-6.25/includes/bootstrap.inc on line 860.
Comments
Comment #1
argosmm commentedHi
I solved this проблем in
yoursite.com/admin/settings/error-reporting
Put these
Write errors to the log
Comment #2
mattyoung commentedThe problem is check_plain only handles UTF-8 string, however, check_plain is called with random user entered text and if those text are not UTF-8, we get this error. The cause of my problem is check_plain() is called with some text with chinese characters in it.
Right now I temporary fix this by hacking check_plain:
function check_plain($text) { static $php525; if (!isset($php525)) { $php525 = version_compare(PHP_VERSION, '5.2.5', '>='); } // We duplicate the preg_match() to validate strings as UTF-8 from // drupal_validate_utf8() here. This avoids the overhead of an additional // function call, since check_plain() may be called hundreds of times during // a request. For PHP 5.2.5+, this check for valid UTF-8 should be handled // internally by PHP in htmlspecialchars(). // @see http://www.php.net/releases/5_2_5.php // @todo remove this when support for either IE6 or PHP < 5.2.5 is dropped. if ($php525) { set_error_handler('mosErrorHandler'); try { $result = htmlspecialchars($text, ENT_QUOTES, 'UTF-8'); } catch(ErrorException $e) { error_log('============== The string is: "' . $text . '"'); error_log($e->getTraceAsString()); } restore_error_handler(); return $result; } return (preg_match('/^./us', $text) == 1) ? htmlspecialchars($text, ENT_QUOTES, 'UTF-8') : ''; } function mosErrorHandler($errno, $errstr, $errfile, $errline, array $errcontext) { // error was suppressed with the @-operator if (0 === error_reporting()) { return false; } throw new ErrorException($errstr, 0, $errno, $errfile, $errline); }Comment #3
droplet commentedsame issue ?
#393538: Document that check_plain() can issue PHP messages on invalid UTF-8 input