New terminal emulation library by Selectel now allows you to run full-featured ncurses apps in Terminal plugin!
Professor Layton & The Unwound Future soundtrack
In case you can’t get your string inserted into DOM tree because it contains unprintable non-ASCII characters, use that:
def fix_unicode(s):
d = ''.join(max(i, ' ') if not i in ['\n', '\t', '\r'] \
else i for i in s)
return unicode(d, errors='replace')