A simple base64 encoder. Simply pass your string and a reference to the function to get back the encoded string.
var map ="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", sample = "140bytes rocks!", encoded = base64Encode(sample, map);
- Proper "=" padding does not work
- IE's JScript fails with the RegExp
- Doesn't encode null bytes
Feel free to fork and improve!