|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69179 The problem is in string length with RTL languages
Submitted: 2015-03-04 07:53 UTC Modified: 2015-03-04 08:39 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rm dot nasir at hotmail dot com Assigned:
Status: Not a bug Package: Strings related
PHP Version: 5.5Git-2015-03-04 (snap) OS: Windows 8.1 Enterprise 32bit
Private report: No CVE-ID: None
 [2015-03-04 07:53 UTC] rm dot nasir at hotmail dot com

I got a problem with my PHP 5.5.12 which I got with WAMP Server.

  When I want to return the length of an Arabic string value it is not showing the exact length of the characters I wrote in that string PHP is increasing the length.

Test script:
header('Content-Type: text/html; charset=utf-8;');

// demo string by Pashto language
$myText = "دا يوه جمله ده";

// length of the string above is 14 characters
// you can test it with JavaScript in your browser console
// and that is returning the exact length 14 but in PHP
// it is showing 25

echo strlen( $myText ); // 25

// I also tested it with

var_dump( $myText ); // string 'دا يوه جمله ده' (length=25)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-04 08:39 UTC]
-Status: Open +Status: Not a bug
 [2015-03-04 08:39 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

Thanks for reporting. strlen() is not multibyte aware, it delivers the count of bytes, not characters. What you do need is probably mb_strlen(), iconv_strlen() or alike with regard to the correct charset settings.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 27 13:01:31 2024 UTC