Improved end-of-file detection in cases of unicode, but still not perfect;
the unicode for 0xffffffff, if there is one, will be considered as eof.
At least it's better than all unicodes that look like negative numbers
indicating eof, which is how it was...