What you are seeing, in the example given above, may have something to do with the PHP magic_quotes setting. At DH, by default, the 4.42 version of PHP is set up to handle this differently then the PHP5 version.
Searching google for "php htmlentities magic quotes" (without the quotes) leads to "a lot" of discussion of the interaction between htmlentities and magic_quotes.
(Edited: I had a link in there, but the forum software "borked" it )
What version of PHP are you using?