php.net |  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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: afarahmand1992 at gmail dot com
New email:
PHP Version: OS:

 

 [2013-06-25 06:16 UTC] afarahmand1992 at gmail dot com
Description:
------------
Hi
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 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-06-25 06:23 UTC] rasmus@php.net
-Status: Open +Status: Not a bug
 [2013-06-25 06:23 UTC] rasmus@php.net
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] rasmus@php.net
You have to specify the correct encoding. eg.

mb_internal_encoding("UTF-8");
echo mb_strlen('ﺏ');
 [2013-06-25 06:55 UTC] afarahmand1992 at gmail dot com
Thank you sir.
All correct :)
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Feb 26 07:01:26 2020 UTC