1. encoding
Convert encodings, uses iconv-lite
encoding
Package: encoding
Created by: andris9
Last modified: Sun, 28 May 2023 20:10:24 GMT
Version: 0.1.13
License: MIT
Downloads: 53,583,072
Repository: https://github.com/andris9/encoding

Install

npm install encoding
yarn add encoding

Encoding

encoding is a simple wrapper around iconv-lite to convert strings from one encoding to another.

Build Status
npm version

Initially encoding was a wrapper around node-iconv (main) and iconv-lite (fallback) and was used as the encoding layer for Nodemailer/mailparser. Somehow it also ended up as a dependency for a bunch of other project, none of these actually using node-iconv. The loading mechanics caused issues for front-end projects and Nodemailer/malparser had moved on, so node-iconv was removed.

Install

Install through npm

npm install encoding

Usage

Require the module

var encoding = require("encoding");

Convert with encoding.convert()

var resultBuffer = encoding.convert(text, toCharset, fromCharset);

Where

  • text is either a Buffer or a String to be converted
  • toCharset is the characterset to convert the string
  • fromCharset (optional, defaults to UTF-8) is the source charset

Output of the conversion is always a Buffer object.

Example

var result = encoding.convert("ÕÄÖÜ", "Latin_1");
console.log(result); //<Buffer d5 c4 d6 dc>

License

MIT

Dependencies

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code