note 108579 added to function.mb-check-encoding
| From: | richard at phase dot org | Date: | Tue, 08 May 2012 15:40:24 +0000 |
| Subject: | note 108579 added to function.mb-check-encoding | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-187523@lists.php.net to get a copy of this message | ||
The issue whereby mb_check_encoding($string,'UTF-8') falsely returns true for invalid UTF8
byte sequences was resolved somewhere between
PHP 5.2.0 and 5.2.6
The following equivalence seems to work in PHP 5.2.0 and 5.1.6
$valid_utf8 = (@iconv('UTF-8','UTF-8',$string) === $string);
(with apologies for the @)
----
Server IP: 94.76.225.145
Probable Submitter: 83.244.193.82
----
Manual Page -- http://www.php.net/manual/en/function.mb-check-encoding.php
Edit -- https://master.php.net/note/edit/108579
Del: integrated -- https://master.php.net/note/delete/108579/integrated
Del: useless -- https://master.php.net/note/delete/108579/useless
Del: bad code -- https://master.php.net/note/delete/108579/bad+code
Del: spam -- https://master.php.net/note/delete/108579/spam
Del: non-english -- https://master.php.net/note/delete/108579/non-english
Del: in docs -- https://master.php.net/note/delete/108579/in+docs
Del: other reasons-- https://master.php.net/note/delete/108579
Reject -- https://master.php.net/note/reject/108579
Search -- https://master.php.net/manage/user-notes.php