Fix escape_once double-escaping hex-encoded entities

(This is a manual merge of #9102)