Encoding auto-detection. Closes #6.