fix #39: detect charset and force encoding

Fix for #39: If the API response specifies a character encoding then force the encoding of the returned string to use the same encoding.