Script to encode HTML special characters

Have you grown tired of typing in all those HTML special characters? Use a perl script instead:

nano ~/bin/
use HTML::Entities;
while (<>) {
    print HTML::Entities::encode($_) ;
} ;
chmod +x ~/bin/

Just a quick test:

echo 'This is a test: "<&>"' | ~/bin/
This is a test: &quot;&lt;&amp;&gt;&quot;

HTML::Entities documentation

Leave a Reply

Your email address will not be published. Required fields are marked *