Be nicer about character encoding of import files

When files are opened in text mode, the Python interpreter decodes the data
in bulk, adn this can make it difficult for a user to identify any malformed
filenames.

It's better to open the file in binary mode and decode each line ourselves.
This allows for more meaningful error reporting; we can report the repr() of
the line that couldn't be decoded.

There's also no good reason to abort the import when encountering a line that
can't be decoded; we may as well skip that line and import as much as we can.