ZF-8717: Add UrlSafe base64 encoding to Zend_Mime


Base64 encoding might be useful for passing binary data via URLs or cookies (since it produces shorter strings then hexdigest). See…

But by default base64 is not urlsafe and there is no urlsafe version in native PHP (at least yet). So I propose to add trivial methods encodeBase64UrlSafe and decodeBase64UrlSafe to Zend_Mime compatible with python's base64.urlsafe_b64encode:

static function encodeBase64UrlSafe($value)
   return str_replace(array('+', '/'), array('-', '_'), base64_encode($value));

static function decodeBase64UrlSafe($value)
   return base64_decode(str_replace(array('-', '_'), array('+', '/'), $value));


Sorry, I have been inactive since last April.