8
print >>sys.stderr,"warning:",msg
12
print >>sys.stderr,"error:",msg
15
### Unicode handling depends very much on whether
16
### your terminal can handle (print) unicode chars.
18
### To be sure about it, just create a non ASCII
19
### letter and try to print it. If that is not going
20
### to work, we create an alternative method which
21
### maps non printable chars to '?'.
23
c = u"\N{LATIN SMALL LETTER O WITH ACUTE}"
27
except UnicodeEncodeError,e:
28
warn("terminal can't display unicode chars.")
31
## I'm just going to redefine 'unicode' to return
34
return x.__str__().encode("ascii","replace")
37
### Now for the input. This should ideally be done
40
### replace stdin with a wrapper that spits out
42
sys.stdin = codecs.lookup('latin1')[-2](sys.stdin)
45
for token in unicode_l.Lexer():
47
except antlr.TokenStreamException, e: