protect against no data
fix indentation of examples
Merge pull request #17 from JonRowe/guard_against_empty

Fix an issue caused by detecting the encoding when first data is empty