a better getch() implementation

notably, it has a sentinel exit value (NUL, ctrl+'@' or ctrl+' ')
it removes the uhh strange range(127) that wans't really used right
and it doesn't execute in the global space, but within a __main__()
correctly test control characters

previously any digit passed ('[0-9]+') -- this is no longer the case -- the number expected by ord() is explicitly matched. Also, notice how p.isalive() returns True even if the child process soon exits -- i wonder if isalive() should recieve a "waitfor=-1" timeout parameter, looping if >0 until False? ah well.
py2 compatibility for encoding testing

indeed, older versions of python could read/write utf-8 files just fine, by using the codecs.open() function, which is pretty much the same thing as python3's io.open.

However, it does not supply a `newline' keyword -- it doesn't seem to matter, so we just `del' it in our dummy function, if used.
use print() as a function

this is in preperation of removing the print_function from future feature for python2.5, so that the test cases can at least be begun to run ..