The current repo belongs to Paused status, and some functions are restricted. For details, please refer to the description of repo status
16 Star 84 Fork 18

SLICE30K / Base64.js
Paused

Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README

Base64.js

如果这个项目对你有帮助或者你觉得这个项目还不错的话,给点个星呗!

简介

虽然JavaScript中可以使用原生的btoa和atob函数进行Base64的编解码。但是不支持中文字符,并且不支持url-safe的Base64编解码。当编码后的结果要是通过get请求传输时(比如跨域提交时),结果中包含有'/'字符将导致出错。

本项目借鉴了loonhxl的 jbase64 项目,并做了一些修改。

  • 支持一般Base64的编码和解码
  • 支持符合RFC_4648标准中"URL and Filename Safe Alphabet"的URL安全Base64编解码
  • 支持中文字符的编解码(Unicode编码)

使用

直接引入

<script type="text/javascript" src="base64.js"></script>

通过RequireJs

require(['base64'], function (BASE64) {
});

通过CommonJs

var BASE64 = require('base64');

示例

BASE64.encode(inputStr);//普通Base64编码
BASE64.decode(inputStr);//普通Base64解码
BASE64.urlsafe_encode(inputStr);//url-safe Base64编码
BASE64.urlsafe_decode(inputStr);//url-safe Base64解码

Empty file

About

支持中文和url-safe编码的Base64编解码库 expand collapse
JavaScript
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
JavaScript
1
https://gitee.com/slice30k/base64-js.git
git@gitee.com:slice30k/base64-js.git
slice30k
base64-js
Base64.js
master

Search

53164aa7 5694891 3bd8fe86 5694891