Report error for invalid escape sequences

fixes #7910