Refactor typespy code to capture non-printable and special characters.