Make WordPress Core

Ticket #28162: 28162.2.patch

File 28162.2.patch, 780 bytes (added by SergeyBiryukov, 11 years ago)
  • src/wp-includes/formatting.php

     
    410410 * @return bool True if $str fits a UTF-8 model, false otherwise.
    411411 */
    412412function seems_utf8($str) {
     413        mbstring_binary_safe_encoding();
    413414        $length = strlen($str);
     415        reset_mbstring_encoding();
    414416        for ($i=0; $i < $length; $i++) {
    415417                $c = ord($str[$i]);
    416418                if ($c < 0x80) $n = 0; # 0bbbbbbb
     
    634636        $num_octets = 1;
    635637        $unicode_length = 0;
    636638
     639        mbstring_binary_safe_encoding();
    637640        $string_length = strlen( $utf8_string );
     641        reset_mbstring_encoding();
     642
    638643        for ($i = 0; $i < $string_length; $i++ ) {
    639644
    640645                $value = ord( $utf8_string[ $i ] );