filter also escape sequences

adapted from b0989cede6a068ec50354fc83a36e46163f831ef