note 120288 deleted from function.utf8-decode by cmb
| From: | cmb@php.net | Date: | Fri, 26 Oct 2018 20:17:39 +0000 |
| Subject: | note 120288 deleted from function.utf8-decode by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-209526@lists.php.net to get a copy of this message | ||
Note Submitter: Alexandru Mazlu
----
This pertains in particular to special characters in strings
// utf8_decode converts special characters in already utf8_decoded strings into ?'s
// if there are more ?'s in the string after decoding, return the original string, it's
probably ok. else, return decoded string
private function safe_utf8_decode($string)
{
ââââ$decoded = utf8_decode($string);
ââââreturn (substr_count($string, '?') < substr_count($decoded,
'?')) ? $string : $decoded;
}