Click to See Complete Forum and Search --> : Replacing HTML Entities
williamscraig
04-11-2005, 11:06 AM
I want to be able to post code (like in this forum) using MovableType - which is written in Perl. I want to be able to post snippets in several languages, converting '<', '>', etc. I've tried a few MT plugins, but haven't been satisfied. Does Perl have a native function to do this, or do I have to write my own? I thought I might intercept it with a PHP script, but if it's easy enough in Perl, I can probably learn enough to get it done. I just haven't been able to face learning a new language right now, ya' know?
Jeff Mott
04-12-2005, 03:22 PM
There is a function written for you in the CGI module, which you should already be using anyway.# example
use CGI;
my $cgi = CGI->new();
my $field = $cgi->param('text-field');
$field = $cgi->escapeHTML($field);
williamscraig
04-12-2005, 11:28 PM
I'm lost. I need to learn enough perl to figure out what I'm looking at. MT also has a way to write PHP plugins, I think. Maybe I'll go the wimpy way. Thanks, anyway, though.
leocharre
04-15-2005, 10:04 PM
Another cool module widely accessible is:
use HTML::Entitites;
if you have $src which contains your non-safe material, you can save it into $safe by:
my $safe= encode_entities($src);
or you can just change $src itself;
$src=encode_entities($src);