note 47149 deleted from function.htmlspecialchars by tularis

From: Date: Thu, 04 Nov 2004 16:08:27 +0000
Subject: note 47149 deleted from function.htmlspecialchars by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79616@lists.php.net to get a copy of this message
Note Submitter: karim dot scheik at prisma-solutions dot at ---- it seems it does NOT replace &#8364; (euro sign) with &euro; (also during posting here it gets replaced with &#8364; ...) i use this general translation function: <?php /** * @return string the translated string * @param string $str stirng to translate * @param bool $br replace line breaks with '<br />'? (default: FALSE); * @param bool $nbsp replace spaces with '&nbsp'? (default: FALSE); * @desc returns html-translated string (replaces special chars, umlauts, euro and optionally line breaks and sapces */ public static function translate($str, $br = FALSE, $nbsp = FALSE) { $r = htmlentities($str); // euro hack // make sure you have the real euro sign here (it gets lost during posting it seems) $r = str_replace('&#8364;', '&euro;', $r); // has to go first because of space in <br /> if($nbsp) $r = str_replace(' ', '&nbsp;', $r); if($br) $r = str_replace("\n", '<br />', $r); return $r; } ?> maybe somebody else here has a use for it too.... ---- Reason: useless example

« previous php.notes (#79616) next »