Issue #46: Encode unicode strings to UTF-8 bytes

The solution proposed in the patch works well for me. When a Unicode string is detected (which is left alone by the serializer before we end up here) it is encoded to UTF-8 to prevent encoding errors later on. Of course: this assumes the JSON is in UTF-8 format (which I think is a reasonable assumption when passing Unicode strings).

An alternative to this would be to try encoding to iso-latin-1 first and then to utf-8 failing that, but I see no advantage in doing that.