note 57339 added to function.utf8-decode
| From: | thierry dot bo#netcourrierpointcom at osu1 dot php dot net | Date: | Fri, 30 Sep 2005 19:38:10 +0000 |
| Subject: | note 57339 added to function.utf8-decode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-96090@lists.php.net to get a copy of this message | ||
In response to fhoech (22-Sep-2005 11:55), I just tried a simultaneous test with the file
UTF-8-test.txt using your regexp, 'j dot dittmer' (20-Sep-2005 06:30) regexp (message
#56962),
php-note-2005 (17-Feb-2005 08:57) regexp in his message on
mb-detect-encoding page
(http://us3.php.net/manual/en/function.mb-detect-encoding.php#50087) who is using a regexp from the
W3C (http://w3.org/International/questions/qa-forms-utf-8.html), and PHP mb_detect_encoding
function.
Here are a summarize of the results :
201 lines are valid UTF8 strings using phpnote regexp
203 lines are valid UTF8 strings using j.dittmer regexp
200 lines are valid UTF8 strings using fhoech regexp
239 lines are valid UTF8 strings using using mb_detect_encoding
Here are the lines with differences (left to right, phpnote, j.dittmer and fhoech) :
Line #70 : NOT UTF8|IS UTF8!|IS UTF8! :2.1.1 1 byte (U-00000000): ""
Line #79 : NOT UTF8|IS UTF8!|IS UTF8! :2.2.1 1 byte (U-0000007F): ""
Line #81 : IS UTF8!|IS UTF8!|NOT UTF8 :2.2.3 3 bytes (U-0000FFFF): "" |
Line #267 : IS UTF8!|IS UTF8!|NOT UTF8 :5.3.1 U+FFFE = ef bf be = "" |
Line #268 : IS UTF8!|IS UTF8!|NOT UTF8 :5.3.2 U+FFFF = ef bf bf = "" |
Interesting is that you said that your regexp corrected j.dittmer regexp that failed on 5.3 section,
but it my test I have the opposite result ?!
I ran this test on windows XP with PHP 4.3.11dev. Maybe these differences come from operating
system, or PHP version.
For mb_detect_encoding I used the command :
mb_detect_encoding($line, 'UTF-8, ISO-8859-1, ASCII');
----
Manual Page -- http://www.php.net/manual/en/function.utf8-decode.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+57339
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+57339&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+57339&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+57339&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+57339&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+57339&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+57339&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+57339&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+57339&report=yes
Search -- http://master.php.net/manage/user-notes.php