note 89581 modified in ref.ctype by danbrown
| From: | danbrown@php.net | Date: | Sun, 15 Mar 2009 15:01:30 +0000 |
| Subject: | note 89581 modified in ref.ctype by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-151970@lists.php.net to get a copy of this message | ||
worth noticing? It seems that the ctype_alpha family of functions won't handle UTF-8 string
(php 5.2.6)
<?php
$texte = 'jérôme';
setLocale(LC_CTYPE, 'FR_fr');
echo 'Pure ascii ? ', (ctype_alpha($texte) ) ? 'yes' : 'no';
echo '<br />';
$texte = iconv( "UTF-8", "ISO-8859-1", $texte) ;
echo 'Letters only ? ' , (ctype_alpha($texte) ) ? 'yes' : 'no';
?>
ouputs :
Pure ascii ? no
Letters only ? yes
--was--
worth noticing? It seems that the ctype_alpha family of functions won't handle UTF-8 string
(php 5.2.6)
<?php
$texte = 'jérôme';
setLocale(LC_CTYPE, 'FR_fr');
echo 'Pure ascii ? ', (ctype_alpha($texte) ) ? 'yes' : 'no';
echo '<br />';
$texte = iconv( "UTF-8", "ISO-8859-1", $texte) ;
echo 'Letters only ? ' , (ctype_alpha($texte) ) ? 'yes' : 'no';
?>
ouputs :
Pure ascii ? no
Letters only ? yes
http://php.net/manual/en/ref.ctype.php