From: Mici M. <mm...@fr...> - 2006-08-15 11:15:07
|
Hi, > of course we accept any workaround function. You're welcome to rename it! :) <?php function htmlspecialchars_workaround($str, $quote =3D ENT_COMPAT, $charset =3D 'iso-8859-1') { if (in_array(strtolower($charset), array('iso-8859-2', 'iso8859-2', 'latin-2', 'latin2'))) { if (! ($quote & ENT_NOQUOTES)) { $str =3D str_replace("\"", """, $str); } if ($quote & ENT_QUOTES) { $str =3D str_replace("\'", "'", $str); } return str_replace(array("<", ">", "&"), array("<", ">", "&"), $str); } else { return htmlspecialchars($str, $quote, $charset); } } ?> Why is it enough to simply replace <, > and &? Because 8859-2 is an 8 bit wide encoding, so each byte is a single char, and each str*() function is applicable on it. If you replace these three chars to < > and &, all other latin2 characters will be ready to display in an HTML document using charset=3Diso-8859-2. No one else can hide or modify the meaning of the chars than the <, > and & signs. mm. =0A=0A_____________________________________________________________________= __ FOTO.hu - Online fot=F3rendel=E9s kidolgoz=E1s. Folyamatos Akci=F3k! Kiv=E1= l=F3 min=F5s=E9g! Ingyen h=E1zhoz sz=E1ll=EDt=E1s!=20 R=E9szletek=E9rt kattintson ide: http://www.foto.hu/index.php?zoneid=3Dorig= o2=20 |