|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65117 problem in returning
Submitted: 2013-06-25 06:16 UTC Modified: 2013-06-25 06:55 UTC
From: afarahmand1992 at gmail dot com Assigned:
Status: Not a bug Package: *Unicode Issues
PHP Version: 5.4Git-2013-06-25 (Git) OS: Windows
Private report: No CVE-ID: None
 [2013-06-25 06:16 UTC] afarahmand1992 at gmail dot com
As you know , ANSI string length is equal to each character,
But in Unicode string (UTF-8) each character returns twice!
And for checking string that can be ANSI or UTF-8 we can't get the real 
length using strlen() !

What should we do?
I think it had better improve the strlen() function to check
the Unicode/ANSI String before return the length 


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-25 06:23 UTC]
-Status: Open +Status: Not a bug
 [2013-06-25 06:23 UTC]
See mb_strlen()
 [2013-06-25 06:28 UTC] afarahmand1992 at gmail dot com
thank you Rasmus
This is my issue 
And I can't believe that "You" answered me :)
 [2013-06-25 06:33 UTC] afarahmand1992 at gmail dot com
Oh it makes no different !

echo mb_strlen('A');
// returns 1

echo mb_strlen('ب');
//returns 2
 [2013-06-25 06:52 UTC]
You have to specify the correct encoding. eg.

echo mb_strlen('ﺏ');
 [2013-06-25 06:55 UTC] afarahmand1992 at gmail dot com
Thank you sir.
All correct :)
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Nov 30 03:03:16 2021 UTC