[ic] Filter tag acts different in store vs Test code - Workaround

Paul Jordan paul at gishnetwork.com
Mon Nov 7 11:03:09 EST 2005

interchange-users-bounces at icdevgroup.org wrote:
> Hi guys
> Why when running this
> 	[filter op="decode_entities 12.
> encode_entities"]<script> [{Hi}] </script> [/filter]
> in the Demo Admin "Test code" I get source as expected:
> 	&lt;script&gt; &#91;{H...
> However when running that same code in the Demo standard store I get:
> 	<script> [{H...
> Upon a View Source.
> Is this a bug or am I missing something obvious.
>  Paul Jordan

Hello, I didn't receive any helpful response probably because there was some
simple answer to my question. I don't know, in my opinion chaining those
filters don't work.

Anyways, if anyone wants to do a length filter on a string and wants to
include (possibly malicious) code to be viewed (in plain text via html) and
does not want the character codes to be "counted" in the length, I have
this. Obviously my length is hardcoded.. Not elegant, but works.

CodeDef subjectshow Filter
CodeDef subjectshow Routine <<EOR
sub {
  my $val = shift;
  my $long = '55';
     $val =~ s/&\#91;/\[/g;		# revert the default IC converted
left square bracket
     if (length($val) > $long) {
        $val = substr($val, 0, $long);
        $val .= '...';
     $val =~ s/\[/&\#91;/g;
     $val =~ s/\</&\#60;/g;
     $val =~ s/&amp;\#(\S+?);/&\#$1;/g;
     $val =~ s/&\#13;&\#13;/\r\n\r\n/g;
     $val =~ s/&\#13;//g;

 Paul Jordan

Gish Network
  Tel 626 285 7609
  Fax Toll Free 866 401 2657
  paul at gishnetwork.com

More information about the interchange-users mailing list