Fix encoding issues for base64 encoded return values

Return values of json payload are base64 encoded.
When decoding the result strings are ASCII-8BIT encoded, which is wrong.
The actual results are UTF-8 encoded and so we force the encoding to behave.