smarty mod

"B. Kamer" <[email protected]> Mon, 25 Jul 2005 13:59:33 +0200
Newsgroups gmane.comp.lib.binarycloud.devel
Message-ID <[email protected]>
hi,

after much searching and searching and searching, i found a problem  
with encoding pages and smarty.escape plugin.

it basicly comes down to the fact that bc uses iconv with utf-8  
internal encoding and the escape functions are not aware of this...

i made a mod but since this really is part of smarty i was wonrdering  
if this mod should go into the bc svn or wheter i should notify   
smarty plp

pls advise...


function smarty_modifier_escape($string, $esc_type = 'html')
{

+    $use_iconv = in_array('iconv', get_loaded_extensions());

     switch ($esc_type) {
         case 'html':
-           return htmlspecialchars($string, ENT_QUOTES);
+            if ($use_iconv) return htmlspecialchars($string,  
ENT_QUOTES, iconv_get_encoding('internal_encoding'));
+            else return htmlspecialchars($string, ENT_QUOTES);

         case 'htmlall':
-           return htmlentities($string, ENT_QUOTES);
+            if ($use_iconv) return htmlentities($string, ENT_QUOTES,  
iconv_get_encoding('internal_encoding'));
+            else return htmlentities($string, ENT_QUOTES);

         case 'url':
             return rawurlencode($string);
  
_______________________________________________
dev mailing list
dev-PnctHDZWAvB/Cz2I37pSEPZ4XP/[email protected]
http://lists.binarycloud.com/mailman/listinfo/dev