No one answered half your question so I'll take a stab
at it. You need the "bolding" to survive the conversion
process to "entities".
The number one suggestion would be to run both texts thru
encode_entities BEFORE comparing them. Then your added
HTML is safe. A second suggestion would be to use a special
chracter that can't appear in the body. like \0175 or some
really low char like \f the formfeed char. encode_entities
will likely grab that and turn it into something like ý
or some so that after encode_entities you can regexp that
marker with the html you want. Use one marker for bold on
and one for bold off.
--
$you = new YOU;
honk() if $you->love(perl)