Функция вот такая:
function strip_nonUtf8($str) {
static $fourbytes = '[\n\t\r\x20-\x7f]|[\xc2-\xdf][\x80-\xbf]|\xe0[\xa0-\xbf][\x80-\xbf]|[\xe1-\xef][\x80-\xbf][\x80-\xbf]|\xf0[\x90-\xbf][\x80-\xbf][\x80-\xbf]|[\xf1-\xf7][\x80-\xbf][\x80-\xbf][\x80-\xbf]';
$result = '';
while (strlen($str) > 2000) {
if (!preg_match("/^($fourbytes){100}/", $str, $match)) {
if (preg_match("/^($fourbytes)*/", $str, $match)) {
$result .= $match[0];
$str = substr($str, strlen($match[0]));
}
// now the first character is bad
$str = substr($str, 1);
continue;
}
$result .= $match[0];
$str = substr($str, strlen($match[0]));
}
if ($str != '' && preg_match_all("/($fourbytes)+/", $str, $matches, PREG_PATTERN_ORDER)) {
$result .= join('', $matches[0]);
}
$result = strip_tags($result);
return $result;
}
Ошибка такая (Chrome):
Error 324 (net::ERR_EMPTY_RESPONSE): The server closed the connection without sending any data.
Видимо функция прерывает исполнение скрипта.