Replace non-ASCII characters with HTML entities.