Safely encode/decode utf8 strings to/from base64