note 124581 added to function.mb-strlen
| From: | DavidSpector@php.net | Date: | Wed, 08 Jan 2020 23:19:24 +0000 |
| Subject: | note 124581 added to function.mb-strlen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-213812@lists.php.net to get a copy of this message | ||
It may not be clear whether PHP actually supports utf-8, which is the current de facto standard
character encoding for Web documents, which supports most human languages. The good news is: it
does.
I wrote a test program which successfully reads in a utf-8 file (without BOM) and manipulates the
characters using mb_substr, mb_strlen, and mb_strpos (mb_substr should normally be avoided, as it
must always start its search at character position 0).
The results with a variety of Unicode test characters in utf-8 encoding, up to four bytes in length,
were mostly correct, except that accent marks were always mistakenly treated as separate characters
instead of being combined with the previous character; this problem can be worked around by
programming, when necessary.
----
Server IP: 45.112.84.4
Probable Submitter: 38.142.137.34 (proxied: 98.2.238.89)
----
Manual Page -- http://php.net/manual/en/function.mb-strlen.php
Edit -- https://master.php.net/note/edit/124581
Del: integrated -- https://master.php.net/note/delete/124581/integrated
Del: useless -- https://master.php.net/note/delete/124581/useless
Del: bad code -- https://master.php.net/note/delete/124581/bad+code
Del: spam -- https://master.php.net/note/delete/124581/spam
Del: non-english -- https://master.php.net/note/delete/124581/non-english
Del: in docs -- https://master.php.net/note/delete/124581/in+docs
Del: other reasons-- https://master.php.net/note/delete/124581
Reject -- https://master.php.net/note/reject/124581
Search -- https://master.php.net/manage/user-notes.php