handle escaping and debug info