note 120288 added to function.utf8-decode
| From: | AlexandruMazlu | Date: | Wed, 07 Dec 2016 12:16:59 +0000 |
| Subject: | note 120288 added to function.utf8-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-208254@lists.php.net to get a copy of this message | ||
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;
}
----
Server IP: 72.52.91.14
Probable Submitter: 89.47.120.26
----
Manual Page -- http://php.net/manual/en/function.utf8-decode.php
Edit -- https://master.php.net/note/edit/120288
Del: integrated -- https://master.php.net/note/delete/120288/integrated
Del: useless -- https://master.php.net/note/delete/120288/useless
Del: bad code -- https://master.php.net/note/delete/120288/bad+code
Del: spam -- https://master.php.net/note/delete/120288/spam
Del: non-english -- https://master.php.net/note/delete/120288/non-english
Del: in docs -- https://master.php.net/note/delete/120288/in+docs
Del: other reasons-- https://master.php.net/note/delete/120288
Reject -- https://master.php.net/note/reject/120288
Search -- https://master.php.net/manage/user-notes.php