Chg: moved the escaping code from the entities to the formatters