Issues

ZF-8717: Add UrlSafe base64 encoding to Zend_Mime

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:

Description

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));
}

Comments

Posted by Satoru Yoshida (satoruyoshida) on 2010-06-12T06:18:40.000+0000

Sorry, I have been inactive since last April.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts