Fixed opening file, fixed a bug in autocomplete

Switched from UTF-8 to autodetecting encoding in open_file() method so
that non-ASCII characters show correctly. Inserting autocomplete
suggestion doesn't delete newline characters anymore.