php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45417 strlen count wrong with accented characters
Submitted: 2008-07-02 14:35 UTC Modified: 2008-07-02 14:36 UTC
From: ponton dot leo at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.6 OS: xp
Private report: No CVE-ID: None
 [2008-07-02 14:35 UTC] ponton dot leo at gmail dot com
Description:
------------
I realize there have been similar bug reports to this. 

I can see why the miscount occurs, but feel that either the returned count should be true (string length) or the manual should warn that the count is apparent (byte length).

Therefore, the problem is either function or documentation.

Reproduce code:
---------------
echo strlen('?');

Expected result:
----------------
expect 1

Actual result:
--------------
get 2

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-07-02 14:36 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

Use mb_strlen() or wait for PHP 6.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 06:01:35 2024 UTC