note 114956 deleted from function.mb-check-encoding by salathe

From: Date: Sat, 14 Aug 2021 09:08:32 +0000
Subject: note 114956 deleted from function.mb-check-encoding by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-216794@lists.php.net to get a copy of this message
Note Submitter: Riikka K ---- To get more information about how this function validates UTF-8, I ran some tests on PHP 5.5.10, PHP 5.4.24 and PHP 5.3.28. It seems that the function detects valid and invalid byte sequences correctly according to UTF-8 and the Unicode specifications, except for one issue: in PHP 5.3.28, the function allows code points above U+10FFFF, which also allows five and six byte sequences. The later versions have corrected this issue. Other than that, each version works correctly. Overlong encodings, surrogates, any lone bytes above 0x80 and too short byte sequences are all considered invalid. All valid code points in Unicode are considered valid when encoded with correct number of bytes (including Astral planes, i.e. four byte squences below U+10FFFF). mb_detect_encoding() provided similar results with strict parameter enabled (except for PHP 5.3.28, in which it performed worse than mb_check_encoding())

« previous php.notes (#216794) next »