New module file_io which takes care of this. All output should go through file_io.write, which encodes it using the appropriate character encoding. For output to a temporary file, use "with file_io.tmpfile('name')". Moved WorblehatException to new module exc, so all modules can access it without importing worblehat.