fix panic in encoding unexported fields

I tried encoding a struct with unexported fields and the whole thing blew up with a panic. I made a [Gist for this][0].

The pull request includes a patch that just ignores those fields. I also provided a test case for this kind of error.

I didn't append myself to the AUTHORS file because I think that would just conflict with the commit in the other pull request. I might be wrong though.
[0]:https://gist.github.com/keks/a2b63e6cbb2aec667052