Fixed small syntax error. +encoding

Fixed a dot that should have been a comma, made the write use the
encoding. I should really put the print with encoding into it's own
function or something. maybe import __future__