|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35520 Functioncs substr, str_replace, strtr and other do not work with UTF-8 string
Submitted: 2005-12-02 12:18 UTC Modified: 2005-12-02 12:24 UTC
Avg. Score:4.4 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:2 (40.0%)
Same OS:1 (20.0%)
From: kotysek at email dot cz Assigned:
Status: Wont fix Package: Strings related
PHP Version: 4.4.1 OS: Windows XP
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-12-02 12:18 UTC] kotysek at email dot cz
If I try to use almost any string function on a string with non-ascii characters encoded in UTF-8 I get some messed up results.

This relates mainly to: substr, str_replace, strtr, strtolower, strtoupper, strlen, ...

My string: consists of czech, slovak, german, etc. chars like ? (č) , ň (ň) ? (ä) , ? (ö) ,...

I can't even use the most basic thing like below.

Reproduce code:
$string = "aa?"; // last character is special czech "c" (č) 
echo $string[2];

Expected result:
// the code should just print "?" (č)

Actual result:
// it prints some character (depends on the character following "?"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-12-02 12:24 UTC]
This is the main reason for PHP6 to appear.
So you have to wait for it.
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 14:01:25 2019 UTC