Check for and handle non-utf-8-encoded input.
Change exception caught in ensure_encoded to UnicodeError.

This is probably the right generality.
Merge pull request #1 from steven-collins-omega/non-utf-8

Check for and handle non-utf-8-encoded input.