Don't throw UnicodeExceptions in pure code

(This is based on https://github.com/tobie/ua-parser/pull/411)

When Unicode decoding errors occur they are now represented as a parse failure (returning `Nothing`) instead of throwing a `UnicodeException` in pure code.

If desired I can base this of `master`.

I also did some refactoring.

@ozataman do you think this is a good idea?