note 76331 added to function.utf8-encode

From: Date: Tue, 10 Jul 2007 23:40:20 +0000
Subject: note 76331 added to function.utf8-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-128369@lists.php.net to get a copy of this message
Tato funkce řeší problém s převodem českých znaků. Seznam je řazen tak, aby znaky s náhradami nekolidovaly. <?php function utf8_encode_cs($text) { $znaky=array( array("ě", 196, 155), array("š", 197, 161), array("ř", 197, 153), array("ý", 195, 189), array("á", 195, 161), array("í", 195, 173), array("é", 195, 169), array("ú", 195, 186), array("ů", 197, 175), array("ď", 196, 143), array("ť", 197, 165), array("ň", 197, 136), array("ó", 195, 179), array("Ě", 196, 154), array("Š", 197, 160), array("Č", 196, 140), array("Ř", 197, 152), array("Á", 195, 129), array("É", 195, 137), array("Ť", 197, 164), array("Ň", 197, 135), array("Ó", 195, 147), array("Ý", 195, 157), array("Ú", 195, 154), array("Ů", 197, 174), array("Í", 195, 141), array("ž", 197, 190), array("Ž", 197, 189), array("č", 196, 141), array("Ď", 196, 142) ); $text=utf8_encode($text); for($i=0; $i<count($znaky); $i++) $text=ereg_replace(utf8_encode($znaky[$i][0]), chr($znaky[$i][1]) . chr($znaky[$i][2]), $text); return $text; } echo utf8_encode_cs("Loď čeří kýlem tůň obzvlášť v Grónské úžině."); ?> ---- Server IP: 147.32.160.17 Probable Submitter: 213.29.65.108 ---- Manual Page -- http://www.php.net/manual/en/function.utf8-encode.php Edit -- https://master.php.net/note/edit/76331 Del: integrated -- https://master.php.net/note/delete/76331/integrated Del: useless -- https://master.php.net/note/delete/76331/useless Del: bad code -- https://master.php.net/note/delete/76331/bad+code Del: spam -- https://master.php.net/note/delete/76331/spam Del: non-english -- https://master.php.net/note/delete/76331/non-english Del: in docs -- https://master.php.net/note/delete/76331/in+docs Del: other reasons-- https://master.php.net/note/delete/76331 Reject -- https://master.php.net/note/reject/76331 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#128369) next »