note 27200 added to function.strtr
| From: | hotmail at rack1 dot php dot net | Date: | Wed, 27 Nov 2002 01:39:26 +0000 |
| Subject: | note 27200 added to function.strtr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-40018@lists.php.net to get a copy of this message | ||
Referring to note from 11 October 2000, Thorn (Þ, þ), Eth (Ð, ð), Esset (ß) and Mu (µ)
aren't really accented letters. , , Æ, æ are ligatures. Best to do the following:
function removeaccents($string){
return strtr(
strtr($string,
'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝàáâãäåçèéêëìíîïñòóôõöøùúûüýÿ',
'SZszYAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'),
array('Þ' => 'TH', 'þ' => 'th', 'Ð'
=> 'DH', 'ð' => 'dh', 'ß' => 'ss',
'' => 'OE', '' => 'oe', 'Æ' =>
'AE', 'æ' => 'ae', 'µ' => 'u'));
}
This would be no good for sorting, as thorn and eth aren't actually found under th and dh.
Also especially redundant because of Unicode! Still, I'm sure somone can find use for it -
perhaps to constrict filenames...
Mark
--
http://www.php.net/manual/en/function.strtr.php
http://master.php.net/manage/user-notes.php?action=edit+27200
http://master.php.net/manage/user-notes.php?action=delete+27200
http://master.php.net/manage/user-notes.php?action=reject+27200