From b7515c5072f9f3dc8bea94bb58d2dd5f782908d6 Mon Sep 17 00:00:00 2001 From: Oskar Date: Wed, 16 Mar 2022 13:34:12 +0100 Subject: [PATCH] Fixed outdated code that no longer works --- src/utf8.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utf8.php b/src/utf8.php index b900cab8..4435d471 100755 --- a/src/utf8.php +++ b/src/utf8.php @@ -678,7 +678,7 @@ function utf8_to_unicode($str) { $len = strlen($str); for($i = 0; $i < $len; $i++) { - $in = ord($str{$i}); + $in = ord($str[$i]); if ($mState == 0) { @@ -990,11 +990,11 @@ static function toUTF8($text){ $max = strlen($text); $buf = ""; for($i = 0; $i < $max; $i++){ - $c1 = $text{$i}; + $c1 = $text[$i]; if($c1>="\xc0"){ //Should be converted to UTF8, if it's not UTF8 already - $c2 = $i+1 >= $max? "\x00" : $text{$i+1}; - $c3 = $i+2 >= $max? "\x00" : $text{$i+2}; - $c4 = $i+3 >= $max? "\x00" : $text{$i+3}; + $c2 = $i+1 >= $max? "\x00" : $text[$i+1]; + $c3 = $i+2 >= $max? "\x00" : $text[$i+2]; + $c4 = $i+3 >= $max? "\x00" : $text[$i+3]; if($c1 >= "\xc0" & $c1 <= "\xdf"){ //looks like 2 bytes UTF8 if($c2 >= "\x80" && $c2 <= "\xbf"){ //yeah, almost sure it's UTF8 already $buf .= $c1 . $c2;