Are there any scripts that can convert between text (e.g.
<hi>) and the html entities version (
<hi>) like this website does? Or at least a PHP file?
The recode utility supports HTML as one of the encodings. (You can even specify an HTML version.) In the text-to-entities direction, it will also recode non-ASCII characters into entities; you need to specify the correct input encoding (e.g. ASCII, latin1, utf-8, …).
recode utf8:html <input-file.txt >output-file.txt recode l1..html file-to-recode.txt
For anyone interested: I wrote a well documented easily readable open-source bash script that converts accented letters in HTML entities. You can find it here: http://www.lugato.co.uk/silvio_dwl.html It is easy to understand so it can be easily modified to convert additional characters in HTML entities ;) Enjoy it! Silvio