note 59710 deleted from function.utf8-encode by cmb
| From: | cmb@php.net | Date: | Fri, 26 Oct 2018 20:19:13 +0000 |
| Subject: | note 59710 deleted from function.utf8-encode by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209529@lists.php.net to get a copy of this message | ||
Note Submitter: migueldiaz at gennio dot com
----
Here's my function to know if one string is encoded in UTF8.
If we encode in UTF8 a string or text file that is already encoded in UTF8, it's expected to
find the character '' ( ALT+159) in the final string.
<?php
function isUTF8($string)
{
$string_utf8 = utf8_encode($string);
if( strpos($string_utf8,"",0) !== false ) // "" is ALT+159
return true; // the original string was utf8
else
return false; // otherwise
}
?>
regards
Miguel Díaz