An open API service indexing awesome lists of open source software.

https://github.com/fabiospampinato/utf16le-encoding

UTF16-le encoding, a.k.a. UCS2 encoding, an encoding you probably should never use.
https://github.com/fabiospampinato/utf16le-encoding

encoding ucs-2 ucs2 utf16 utf16le

Last synced: 11 months ago
JSON representation

UTF16-le encoding, a.k.a. UCS2 encoding, an encoding you probably should never use.

Awesome Lists containing this project

README

          

# UTF16le

UTF16-le encoding, a.k.a. UCS2 encoding, an encoding you probably should never use.

## Install

```sh
npm install utf16le-encoding
```

## Usage

```ts
import UTF16le from 'utf16le-encoding';

// Uint8Array encoding & decoding

{
const raw = 'Hello πŸ˜ƒ';
const uint8 = new TextEncoder ().encode ( raw );
console.log ( uint8 ); // => Uint8Array(10) [ 72, 101, 108, 108, 111, 32, 240, 159, 152, 131 ]

const encoded = UTF16le.encode ( uint8 );
console.log ( encoded ); // => 'ζ•ˆζ±¬β―ιΏ°θŽ˜'

const decoded = UTF16le.decode ( encoded );
console.log ( decoded ); // => // => Uint8Array(10) [ 72, 101, 108, 108, 111, 32, 240, 159, 152, 131 ]
}
```

## License

MIT Β© Fabio Spampinato