Easily encoding documents prior to publishing them to the web

While reviewing the command lines on commandlinefu, I came across this nifty little gem:

$ perl -MHTML::Entities -ne ‘print encode_entities($_)’ FILETOENCODE

This command line snippet takes a file as an argument, and escapes all of the characters that can’t be directly published on the web (i.e., it will convert a right bracket to & gt). This is super useful, and is a welcome addition to the nifty tidy utility!

Leave a Reply

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