[ic] Filter Example (4.9 and up) for URL-style escapes

Stefan Hornburg racke at linuxia.de
Tue Jul 29 14:19:47 EDT 2003


Hello, List !

In one of my projects I needed to escape the slash for filenames (the filesafe
filter doesn't help here). 

catalog.cfg:
CodeDef escape Filter
CodeDef escape Routine <<EOR
sub {
	my ($value, $tag, $char) = @_;
	my $rex = qr($char);
	my $rpl = sprintf("%%%02x", ord($char));

	$value =~ s/$rex/$rpl/eg;
	$value;
}
EOR

Usage example
[filter op="escape./"]AC/DC Wandler[/filter]

Ciao
	Racke


-- 
LinuXia Systems => http://www.linuxia.de/
Expert Interchange Consulting and System Administration
ICDEVGROUP => http://www.icdevgroup.org/
Interchange Development Team



More information about the interchange-users mailing list