updated entities() to optionally preserve HTML
updated entities() to optionally preserve HTML