Sanitize OSC title sequence

With last commit 436c1dd10c1e23c60052ebd0c7577044ef01ce71, now title reporting feature can be enabled from preference panel.
In my personal opinion, there is some problems in this feature, and "title stacking" feature may be an alternate solution in most use cases.
Especially, iTerm2's title string allows injection of control characters(\x00-\x1f, \x7f). The combination of them can cause dangerous issue.

This patch sanitize title string(replace control characters with '?') when the terminal receives OSC 0/1/2 sequence. 

In additional, it includes some small fixes:

1. Fix broken OSC behavior (Linux console), it does not need terminator.
2. Fix broken ST behavior. change the effect of 8bit glitch sequence (ESC + 0xbd / ESC + 0xdd, now it is not ignored in current 7bit Xterm), and if broken ST detected, the control string should be discarded.
3. Fix CAN/SUB behavior, if a control string includes them, the parsing process should be canceled immediately.
4. A test script(tests/osc.py) is added.