Dealing with non-ASCII text and HTML entities