note 55631 added to function.utf8-decode

From: Date: Tue, 09 Aug 2005 10:54:01 +0000
Subject: note 55631 added to function.utf8-decode
Groups: php.notes 
Request: Send a blank email to php-notes+get-93303@lists.php.net to get a copy of this message
A small improvement. JF Sebastian's regex for UTF-8 is not quite correct. Because code points could otherwise be coded in more than one way using UTF-8, the Standard stipulates that the shortest possible representation for a character should be used. So some 'duplicate' combinations his regex accepts are not valid UTF-8. Additionally, his regex accepts characters beyond the valid Unicode code space. The regex should be: ^([\x00-\x7f]| [\xc2-\xdf][\x80-\xbf]| [\xe0][\xa0-\xbf][\x80-xbf]| [\xe1-\xec][\x80-\xbf]{2}| [\xed][\x80-\x9f][\x80-\xbf]| [\xee-\xef][\x80-\xbf]{2}| [\xf0][\x90-\xbf][\x80-\xbf]{2}| [\xf1-\xf3][\x80-\xbf]{3}| [\xf4][\x80-\x8f][\x80-\xbf]{2}*$) ---- Manual Page -- http://www.php.net/manual/en/function.utf8-decode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55631 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55631&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55631&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55631&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55631&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55631&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55631&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55631&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93303) next »