Improve XML/HTML entity escaping