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

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Enhancing Vue.js Development: Harnessing the Potential of Vue-Loader

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Simplify Data Validation in Vue.js: A Step-by-Step Guide to Using Regex

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Troubleshooting Made Easy: Common Issues and Solutions with vue-loader Without vue-cli

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Optimizing Webpack 4 with Vue CLI 3: Disabling the Cache-Loader

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin

Step-by-Step Guide: How to Add a Function to Your Vuex Plugin