note 99514 deleted from function.imagettftext by danbrown

From: Date: Fri, 20 Aug 2010 21:07:45 +0000
Subject: note 99514 deleted from function.imagettftext by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-171908@lists.php.net to get a copy of this message
Note Submitter: Daniel S - tracid2008 at googlemail.com ---- @ limalopex.eisfux.de Here is a shorter solution for the problem with german umlauts: function utf8_convert($text) { // convert to HTML entities $text = mb_convert_encoding($text, 'HTML-ENTITIES', "UTF-8"); // convert HTML entities to ISO-8859-1 $text = html_entity_decode($text, ENT_NOQUOTES, "ISO-8859-1"); // replace characters > ascii 127 to hexidecimal equivalents $out = ''; for($i = 0; $i < strlen($text); $i++) { $letter = $text[$i]; $num = ord($letter); if($num > 127) { // replace ascii > 127 $out .= '&#' . $num; } else { // leave letter intact $out .= $letter; } } return $out; }

« previous php.notes (#171908) next »