change to use htmlspecialchars instead of htmlentities to resolve issue with &rsquot; appearing etc