Javascript encoding test for url?
<p>I need to send data via a url (it's JSON'd) that I would like to encrypt using some method that I can then decrypt it using php. I was thinking base64, but I need a url safe base 64 (I'm using CI and CI removes +,= and /).</p>

<p>Is there anyway to duplicate </p>

<pre><code>function url_base64_encode(&amp;$str="")
{
    return strtr(
            base64_encode($str),
            array(
                '+' =&gt; '.',
                '=' =&gt; '-',
                '/' =&gt; '~'
            )
        );
}
</code></pre>

<p>in Javascript?</p>

<p>Or some other alternative?</p>
