php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #41239 Special chars not handled as alpha numeric
Submitted: 2007-04-30 10:21 UTC Modified: 2007-04-30 11:17 UTC
From: rene dot stabingis at gmail dot com Assigned:
Status: Not a bug Package: *Regular Expressions
PHP Version: 5.2.1 OS: Linux 2.6.13.2 (Debian 3.1)
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rene dot stabingis at gmail dot com
New email:
PHP Version: OS:

 

 [2007-04-30 10:21 UTC] rene dot stabingis at gmail dot com
Description:
------------
This code should delete all non-alphanumeric signs (except spaces).
If you have latin special chars like "?", on the linux machine they are deleted. On a win environment using same php version they are kept as alnum. The deb machine runs with ISO-8859-1 charset.

Reproduce code:
---------------
$somePhrase = 'i don\'t know why, but many people know ?ber';
echo preg_replace('/[^[:alnum:][:space:]]/', '', $somePhrase);

Expected result:
----------------
i dont know why but many people know ?ber

Actual result:
--------------
i dont know why but many people know ber

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-30 10:46 UTC] derick@php.net
You need to use the correct locale, see setlocale() documentation.
 [2007-04-30 11:17 UTC] rene dot stabingis at gmail dot com
I'm sorry but setlocale(LC_ALL, 'de_DE'); has no effect. Same with an explicit set of the german or german/european charset. (btw same behaviour on a freebsd4 machine)
Until now i have only seen problems with this on ubuntu machines running with utf8 standard charset
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 06 15:01:28 2024 UTC