[nycphp-talk] PHP + UTF-8 + mb_string issue.
Michael B Allen
mba2000 at ioplex.com
Wed Mar 21 02:06:41 EDT 2007
On Wed, 21 Mar 2007 10:50:26 +0530
Anirudh Zala <arzala at gmail.com> wrote:
> Hello Everybody,
>
> While building a truly multilingual project, I am running into an interesting
> problem with php5 + utf-8 + mb_string.
<snip>
> ____________ = 1 word; 4 bytes; 2 characters (______, ______); 4 key-strokes (___, ___, ___, ___);
> "strlen" should be 2 but is 4.
Generally the libc-like functions exhibit libc behavior so 4 is the
correct answer.
Is mb_strlen not suitable for some reason? You have to use mb_* functions
whenever you perform character-wise operations as opposed to byte-wise
(and that assumes you're running in the UTF-8 locale).
Mike
--
Michael B Allen
PHP Active Directory Kerberos SSO
http://www.ioplex.com/
More information about the talk
mailing list