FIX error management on emoji and utf8 validity by emailcollector

This commit is contained in:
Laurent Destailleur
2023-05-17 14:23:14 +02:00
parent 9743bbde60
commit 76de309cd9
2 changed files with 51 additions and 3 deletions

View File

@@ -8794,6 +8794,22 @@ function utf8_check($str)
return true;
}
/**
* Check if a string is in UTF8
*
* @param string $str String to check
* @return boolean True if string is valid UTF8 string, false if corrupted
*/
function utf8_valid($str)
{
/* 2 other methods to test if string is utf8
$validUTF8 = mb_check_encoding($messagetext, 'UTF-8');
$validUTF8b = ! (false === mb_detect_encoding($messagetext, 'UTF-8', true));
*/
return preg_match('//u', $str) ? true : false;
}
/**
* Check if a string is in ASCII
*