Fix guess_encoding()

Turns out commit 7a9da3b0f obliterated a difference that mattered - the
different argument to magic.open() in guess_mimetype() and guess_encoding()

This commit reinstates that difference, and has a correct use of the pip
python-magic library to get the encoding.