fix decode/encode of html entities in attributes and text