Base64 functions

Base64 functions
 点击下载

Encodes and Decodes the given data in base64.
This encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean, such as mail bodies.
Base64-encoded data takes about 33% more space than the original data.

This javascript code is used to encode / decode data using base64 (this encoding is designed to make binary data survive transport through transport layers that are not 8-bit clean). Script is fully compatible with UTF-8 encoding. You can use base64 encoded data as simple encryption mechanism.
If you plan using UTF-8 encoding in your project don't forget to set the page encoding to UTF-8 (Content-Type meta tag).

  1. $.base64Encode("I'm Persian."); // return "SSdtIFBlcnNpYW4u" 
  2. $.base64Decode("SSdtIFBlcnNpYW4u"); // return "I'm Persian." 

 

转载请注明:代码家园 » Base64 functions

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)