<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>PHPDeveloper.org</title>
    <link>http://www.phpdeveloper.org</link>
    <description>Up-to-the Minute PHP News, views and community</description>
    <language>en-us</language>
    <pubDate>Wed, 19 Jun 2013 00:43:00 -0500</pubDate>
    <ttl>30</ttl>
    <item>
      <title><![CDATA[Marcus Bointon's Blog: PHP Base-62 Encoding]]></title>
      <guid>http://www.phpdeveloper.org/news/16706</guid>
      <link>http://www.phpdeveloper.org/news/16706</link>
      <description><![CDATA[<p>
In a recent post <i>Marcus Bointon</i> looks at a hashing method that's not one as commonly used by developers as the usual <a href="http://php.net/base64_encode">base64</a> - <a href="http://marcus.bointon.com/archives/92-PHP-Base-62-encoding.html">base-62 encoding</a> that plays a bit nicer with things like URLs and emails due to the character set it allows.
</p>
<blockquote>
There's a really horrible bug (though they won't call it that!) in Apache's mod_rewrite that means that urlencoded inputs in rewrites get unescaped in their transformation to output patterns. The bug actually remains unfixed, though a workaround first appeared in Apache 2.2.12. [...] Base-62 is interesting as it can be made safe for use in URLs, DNS, email addresses and pathnames, unlike any available encoding of base-64, as it only includes [0-9A-Za-z].
</blockquote>
<p>
He originally wrote his own parser, but notes that now the <a href="http://li.php.net/manual/en/book.bc.php">BCMath</a> and <a href="http://li.php.net/manual/en/book.gmp.php">gmp</a> extensions make it much simpler, just a call to <a href="http://www.php.net/gmp_strval">gmp_strval</a> with <a href="http://www.php.net/gmp_init">gmp_init</a>. This method works, but it's still not quite all he wanted so he <a href="https://gist.github.com/1139429">created his own encoder</a> to do the job.
</p>]]></description>
      <pubDate>Thu, 11 Aug 2011 11:28:46 -0500</pubDate>
    </item>
  </channel>
</rss>
