wtf8

A Node.JS UTF-8 encoder and decoder which is able to handle characters outside Basic Multilingual Plane

MIT 3 个版本
安装
npm install wtf8
yarn add wtf8
pnpm add wtf8
bun add wtf8
README

WTF8 Build Status

A UTF-8 decoder and encoder which can handle characters outside Basic Multilingual Plane for node.js. It's also reasonably fast.

Why?

V8 doesn't like 4-byte UTF-8 characters. 😞

Methods

.decode(buffer)

Decode buffer containing UTF-8 data to JS string.

var utf8 = require('wtf8');
utf8.decode(new Buffer([0x68, 0x65, 0x6c, 0x6c, 0x6f]));
// => 'hello'

.encode(string)

Encode strings to buffer.

var utf8 = require('wtf8');
utf8.encode('hello');
// => <SlowBuffer 68 65 6c 6c 6f>

TODO

  • stream piping
版本列表
0.2.0 2015-02-23
0.1.1 2012-02-16
0.1.0 2012-02-14