note 52098 deleted from function.strtr by googleguy

From: Date: Tue, 22 Oct 2013 10:18:22 +0000
Subject: note 52098 deleted from function.strtr by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-196995@lists.php.net to get a copy of this message
Note Submitter: -sven (www.bitcetera.com) ---- 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.)

« previous php.notes (#196995) next »