24 if (preg_match(
'%[\x00-\x08\x0B-\x0C\x0E\x0F]%', $str)) {
28 return (
bool)preg_match(
'%%u', $str);
44 $encoding = mb_detect_encoding($str, [
'UTF-8',
'ISO-8859-1',
'WINDOWS-1252'],
true);
48 $newStr = utf8_encode($str);
62 return (preg_replace(
'%(?:[\x00-\x08\x0B-\x0C\x0E-\x1F\x7F])%',
'', $newStr));
Useful utilities for working with various strings.
static isUTF8($str)
Returns true or false depending on if a string is valid UTF-8.
static convertToUTF8($str)
This method tries its best to convert the input string to UTF-8.