note 52098 added to function.strtr

From: Date: Thu, 21 Apr 2005 06:48:11 +0000
Subject: note 52098 added to function.strtr
Groups: php.notes 
Request: Send a blank email to php-notes+get-88309@lists.php.net to get a copy of this message
And while we're at it, yet another transcriber (the code formerly known as accent remover). It does accents and umlauts, but also ligatures and runes known to ISO-8859-1. The translation strings must be on one line without any whitespaces in it. They are rendered hardwrapped here because this documentation doesn't allow long lines in notes. function transcribe($string) { $string = strtr($string, "\xA1\xAA\xBA\xBF\xC0\xC1\xC2\xC3\xC5\xC7 \xC8\xC9\xCA\xCB\xCC\xCD\xCE\xCF\xD0\xD1 \xD2\xD3\xD4\xD5\xD8\xD9\xDA\xDB\xDD\xE0 \xE1\xE2\xE3\xE5\xE7\xE8\xE9\xEA\xEB\xEC \xED\xEE\xEF\xF0\xF1\xF2\xF3\xF4\xF5\xF8 \xF9\xFA\xFB\xFD\xFF", "!ao?AAAAAC EEEEIIIIDN OOOOOUUUYa aaaaceeeei iiidnooooo uuuyy"); $string = strtr($string, array("\xC4"=>"Ae", "\xC6"=>"AE", "\xD6"=>"Oe", "\xDC"=>"Ue", "\xDE"=>"TH", "\xDF"=>"ss", "\xE4"=>"ae", "\xE6"=>"ae", "\xF6"=>"oe", "\xFC"=>"ue", "\xFE"=>"th")); return($string); } (Funky: ISO-8859-1 does not cover the french "oe" ligature.) ---- Manual Page -- http://www.php.net/manual/en/function.strtr.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52098 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52098&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52098&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52098&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52098&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52098&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52098&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88309) next »