Problem with ctype_alnum and locale special characters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
danf_1979
Forum Commoner
Posts: 72
Joined: Sun Feb 20, 2005 9:46 pm

Problem with ctype_alnum and locale special characters

Post by danf_1979 »

I have this on my source code, but it does not work:

Code: Select all

setlocale(LC_ALL, 'es_CL.utf8');

// Do add result
$clean = array();
if (isset($_POST["name"]) && !empty($_POST["name"]) && ctype_alnum($_POST["name"]) && strlen($_POST["name"]) < 50) {
		$mysql["name"] = clean_input($_POST["name"]);
}
else{
                 //display error
}
And the locale is there:

Code: Select all

dan@www:~$ locale -a | grep CL
es_CL.utf8
I want ctype_alnum to recognize characters like á,ó,ú, etc... is this possible? someone has done it?
Thanks.
Post Reply