Re: Re: Request: add |escape:"decentity"

Ruben Vermeersch <[email protected]>
Newsgroups gmane.comp.php.smarty.devel
Message-ID <1080912201.4990.1.camel@neferteti>
Submit your changes in diff format, makes the life of messju, monte, and
well, everybdoy a lot easier.

Anyway, here's the patch for this piece of code

Regards, Ruben
 

On Fri, 2004-04-02 at 14:37, Konstantin A. Pelepelin wrote:
> > Hi!
> >
> > As I've found today, IE4 doesn't understand hexadecimal entities (&#x40;), but understands decimal (&#64;).
> >
> > I understand, most of people don't care about IE4 these days, but anyway it's not difficult.
> >
> > Code to insert into smarty_modifier_escape
> >
> > case 'decentity':
> > 	$return = '';
> > 	for ($x=0; $x < strlen($string); $x++) {
> > 		$return .= '&#' . ord($string[$x]) . ';';
> > 	}
> > 	return $return;
> 
> And similar change should be made to function.mailto.php
> replace
> 	$text_encode .= '&#x' . bin2hex($text[$x]).';';
> with
> 	$text_encode .= '&#' . ord($text[$x]).';';
> 
> 
> WBR,
> Konstantin A. Pelepelin
-- 
# ------------------------------ #
# Ruben Vermeersch               #
# E-mail: [email protected]       #
# Website: http://www.Lambda1.be #
# Mobile: +32495338869           #
# ------------------------------ #

-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
escape_modifier.patch (text/x-patch, 831 B)
? escape_modifier.patch
Index: plugins/modifier.escape.php
===================================================================
RCS file: /repository/smarty/libs/plugins/modifier.escape.php,v
retrieving revision 1.11
diff -u -b -B -r1.11 modifier.escape.php
--- plugins/modifier.escape.php	19 Dec 2003 17:18:56 -0000	1.11
+++ plugins/modifier.escape.php	2 Apr 2004 13:21:53 -0000
@@ -53,6 +53,13 @@
             // escape quotes and backslashes and newlines
             return strtr($string, array('\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',"\r"=>'\\r',"\n"=>'\\n'));
 
+        case 'decentity' :
+            $return = '';
+            for ($x=0; $x < strlen($string); $x++) {
+                $return .= '&#' . ord($string[$x]) . ';';
+            }
+            return $return;
+
         default:
             return $string;
     }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.