File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,13 +42,6 @@ function __($str)
4242 define ('USE_UTF_STRINGS ' , true );
4343 }
4444
45- // Set internal character to UTF-8.
46- // In previous versions of PHP (5.5 and older) the default internal encoding is
47- // "ISO-8859-1".
48- if ((defined ('USE_UTF_STRINGS ' )) && (USE_UTF_STRINGS )) {
49- mb_internal_encoding ('UTF-8 ' );
50- }
51-
5245 /**
5346 * Performs lexical analysis over a SQL statement and splits it in multiple
5447 * tokens.
@@ -192,7 +185,7 @@ public function __construct($str, $strict = false)
192185 // For multi-byte strings, a new instance of `UtfString` is
193186 // initialized (only if `UtfString` usage is forced.
194187 if (!($ str instanceof UtfString)) {
195- if ((USE_UTF_STRINGS ) && ($ len != mb_strlen ($ str ))) {
188+ if ((USE_UTF_STRINGS ) && ($ len !== mb_strlen ($ str, ' UTF-8 ' ))) {
196189 $ str = new UtfString ($ str );
197190 }
198191 }
Original file line number Diff line number Diff line change @@ -250,18 +250,18 @@ public function extract()
250250 case Token::TYPE_STRING :
251251 $ quote = $ this ->token [0 ];
252252 $ str = str_replace ($ quote . $ quote , $ quote , $ this ->token );
253- return mb_substr ($ str , 1 , -1 ); // trims quotes
253+ return mb_substr ($ str , 1 , -1 , ' UTF-8 ' ); // trims quotes
254254 case Token::TYPE_SYMBOL :
255255 $ str = $ this ->token ;
256256 if ((isset ($ str [0 ])) && ($ str [0 ] === '@ ' )) {
257- $ str = mb_substr ($ str , 1 );
257+ $ str = mb_substr ($ str , 1 , null , ' UTF-8 ' );
258258 }
259259 if ((isset ($ str [0 ])) && (($ str [0 ] === '` ' )
260260 || ($ str [0 ] === '" ' ) || ($ str [0 ] === '\'' ))
261261 ) {
262262 $ quote = $ str [0 ];
263263 $ str = str_replace ($ quote . $ quote , $ quote , $ str );
264- $ str = mb_substr ($ str , 1 , -1 );
264+ $ str = mb_substr ($ str , 1 , -1 , ' UTF-8 ' );
265265 }
266266 return $ str ;
267267 }
Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ public function __construct($str)
8181 // overloading is enabled.
8282 // https://php.net/manual/ro/mbstring.overload.php
8383 $ this ->byteLen = strlen ($ str );
84- $ this ->charLen = mb_strlen ($ str );
84+ $ this ->charLen = mb_strlen ($ str, ' UTF-8 ' );
8585 }
8686
8787 /**
You can’t perform that action at this time.
0 commit comments