If there is one thing that the whole input sanitation, SQL, PHP and JS saga should have told people loud and clear by now it is that you don't mix your control and your payload streams. FTP got this right, most other things did not. Anything that relies on escape sequences will either be buggy, broken or insecure. Or a combination of all of those. In-band signalling was a mistake when the phone network did it, it's still a mistake today.