diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 2c95dbe8e2..ae38869994 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -94,7 +94,8 @@ function wpautop($pee, $br = 1) { function seems_utf8($Str) { # by bmorel at ssi dot fr - for ($i=0; $i $length ) ) + if ( $length && ( $unicode_length >= $length ) ) break; $unicode .= chr($value); + $unicode_length++; } else { if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3; $values[] = $value; - if ( $length && ( (strlen($unicode) + ($num_octets * 3)) > $length ) ) + if ( $length && ( $unicode_length + ($num_octets * 3) ) > $length ) break; if ( count( $values ) == $num_octets ) { if ($num_octets == 3) { $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]); + $unicode_length += 9; } else { $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]); + $unicode_length += 6; } $values = array();