Sanitize OSC title sequence

By last commit 436c1dd10c1e23c60052ebd0c7577044ef01ce71, now title reporting feature can be enabled from preference panel.
In my opinion, there is some problems around 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 addition, it also includes some small fixes:

1. Fix broken OSC behavior (Linux console, ESC ] Pnrrggbb), it does not require any terminators.
2. Fix broken ST behavior. change the effect of 8bit glitch sequences (ESC + 0xbd / ESC + 0xdd, now they are not ignored in current 7bit-mode Xterm), and if broken ST is 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.