note 112867 added to function.mb-check-encoding

From: Date: Tue, 30 Jul 2013 23:45:02 +0000
Subject: note 112867 added to function.mb-check-encoding
Groups: php.notes 
Request: Send a blank email to php-notes+get-195831@lists.php.net to get a copy of this message
Note that the algorithm in javalc6's comment checks UTF-8 compliance by the letter of the specs. This means that overlong byte sequences will pass. For example: 0xC0 0xAF can be used to encode U+002F, the slash character. While legal, this character is more properly encoded as 0x2F. Overlong sequences are unnecessary and should be avoided; they have been - and still are - used in various attacks (like directory traversal attacks). It also means that high Unicode characters outside the Basic Multilingual Plane will pass; this means characters above U+FFFF, composed of 4+ bytes (hieroglyhps, cuneiform, etc). You need to decide if you want those characters or not. If you do, be aware that they often cause compatibility problems (for example with JSON and some databases). mb_check_encoding(), mb_detect_encoding(x, y, TRUE), and the other comments up to now all reject characters outside the BMP and overlong sequences. ---- Server IP: 69.147.83.199 Probable Submitter: 213.47.132.228 ---- Manual Page -- http://php.net/manual/en/function.mb-check-encoding.php Edit -- https://master.php.net/note/edit/112867 Del: integrated -- https://master.php.net/note/delete/112867/integrated Del: useless -- https://master.php.net/note/delete/112867/useless Del: bad code -- https://master.php.net/note/delete/112867/bad+code Del: spam -- https://master.php.net/note/delete/112867/spam Del: non-english -- https://master.php.net/note/delete/112867/non-english Del: in docs -- https://master.php.net/note/delete/112867/in+docs Del: other reasons-- https://master.php.net/note/delete/112867 Reject -- https://master.php.net/note/reject/112867 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#195831) next »