镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

About

utf8 encoder/decoder of whatwg Encoding Living Standard https://encoding.spec.whatwg.org/

Resources

Stars

9 stars

Watchers

1 watching

Forks

Latest commit

 

History

87 Commits

Folders and files

Repository files navigation

Isomorphic Encoding Standard implementation ignore support without UTF-8

about

implementation of Encoding Standard TextEncoder & TextDecoder. https://encoding.spec.whatwg.org/

but this spec includes tons of legacy encoding support you may never use. so support only UTF-8 encoding/decoding for make script small for browser friendly :)

install

$ npm install utf8-encoding

usage

works in node and browser. Isomorphic !! no Browserify.

var encoder = new TextEncoder();
var decoder = new TextDecoder();
console.log(encoder.encode("beer!🍻"));
// Uint8Array[98, 101, 101, 114, 33, 240, 159, 141, 187]
console.log(decoder.decode(new Uint8Array([98, 101, 101, 114, 33, 240, 159, 141, 187])));
// "beer!🍻

build

$ npm install
$ npm run tsc

will build utf8-encoding.js.

or you can get build result from release branch which is same as npm intsall.

test

$ npm install
$ npm test

and also open test/index.html in your browser and see console.

for TypeScript

use utf8-encoding.d.ts

other types which this scripts depends on are in types directory.

release process

  • develop/maintain on master branch
  • if finished, dump version to new one in package.json
  • checkout release and merge master --no-ff
  • build via npm test
  • commit build
  • add tag
  • push to github
  • npm publish

License

The MIT License (MIT) Copyright (c) 2015 Jxck

About

utf8 encoder/decoder of whatwg Encoding Living Standard https://encoding.spec.whatwg.org/

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages