Replace built-in base64 encoding to cope with UTF-8