It only works for ASCII data, not binary, so there's your problem 
Hmm, not really. The problem is that you can't use the XON and XOFF codes for binary data. This is easy to solve (use upper seven bits only, convert base 256 to base 254, variable length encoding), that's why I asked what's wrong with it.