|  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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: afarahmand1992 at gmail dot com
New email:
PHP Version: OS:


 [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-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 23:01:31 2024 UTC