Coder Social home page Coder Social logo

fabiospampinato / utf16le-encoding Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 9 KB

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

License: MIT License

TypeScript 32.42% JavaScript 67.58%
utf16 utf16le ucs2 ucs-2 encoding

utf16le-encoding's Introduction

UTF16le

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

Install

npm install --save utf16le-encoding

Usage

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

utf16le-encoding's People

Contributors

fabiospampinato avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.