JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q21061F
  • License MIT

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

Package Exports

  • wtf8

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wtf8) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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