Fix print function for UTF-8 encoded files

The print statement/function in Python 2 treats any file (other than
actual terminals) as ascii encoded. Override the print function to
always use the file.encoding and subclass file to give us UTF-8 encoded
text files.

Some modules needed to be converted to use the print function.

This is something that just works in Python 3 if the correct encoding is
specified when opening a file in text mode... Well, that's what happens
when you start coding in a deprecated language version.