|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #17298 stristr is not case-insensitive with scandinavian alphabets
Submitted: 2002-05-17 18:04 UTC Modified: 2002-05-17 18:51 UTC
From: hannu dot maksimainen at edu dot hel dot fi Assigned:
Status: Not a bug Package: Strings related
PHP Version: 4.2.0 OS: linux 2.4.18
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
38 + 2 = ?
Subscribe to this entry?

 [2002-05-17 18:04 UTC] hannu dot maksimainen at edu dot hel dot fi
I have a string "There are ? and ? in scandinavian alphabets".

I want stristr function to return everything after the first occurence of "?" (capital ? in this case) in my script:

$str = "There are ? and ? in scandinavian alphabets";
echo stristr($str, "?");

It returns "? in scandinavian alphabets".
It should return "? and ? in scandinavian alphabets".

With 'normal' alphabets it works ok. Like this:

$str = "There are B and b in scandinavian alphabets";
echo stristr($str, "b");

and it returns "B and b in scandinavian alphabets"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-05-17 18:13 UTC]
I can't reproduce might be some locale issue.
Which linux distro?


 [2002-05-17 18:40 UTC] hannu dot maksimainen at edu dot hel dot fi
Mandrake 7.2 with kernel 2.4.18
apache 2.0.35
php 4.2.0

I also tested this with my friend's server and it didn't work there either. He has Debian Linux (2.4.16 kernel) with apache 1.3.23 and php 4.1.2.
 [2002-05-17 18:51 UTC]
It's really a locale issue. Not PHP problem in, you just need to set the locale correctly.

Either via environment var LC_ALL or setting it in the script with setlocale(), e.g.:

setlocale(LC_ALL, "fi_FI");


 [2002-05-17 19:01 UTC] hannu dot maksimainen at edu dot hel dot fi
That fixed the problem.

To be more specific, it is enough to write setlocale(LC_CTYPE, "fi_FI") in this case.

"LC_CTYPE for character classification and conversion"

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Jun 17 03:01:28 2024 UTC