begin writing function; handle HTML entity codes