Support trying multiple encodings

This fixes #26.