Replaces all occurences of spwcial chars in the string with HTML entities and returns the resulting string