Issue Type: Improvement Created: 2010-01-05T16:04:01.000+0000 Last Updated: 2011-08-07T12:22:26.000+0000 Status: Open Fix version(s): Reporter: Vladimir Razuvaev (vladar) Assignee: Benjamin Eberlei (beberlei) Tags: - Zend_Mime
Related issues: Attachments:
Base64 encoding might be useful for passing binary data via URLs or cookies (since it produces shorter strings then hexdigest). See http://en.wikipedia.org/wiki/Base64/…
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:
<pre class="highlight">
static function encodeBase64UrlSafe($value)
{
return str_replace(array('+', '/'), array('-', '_'), base64_encode($value));
}
static function decodeBase64UrlSafe($value)
{
return base64_decode(str_replace(array('-', '_'), array('+', '/'), $value));
}
Posted by Satoru Yoshida (satoruyoshida) on 2010-06-12T06:18:40.000+0000
Sorry, I have been inactive since last April.