Socket
Socket
Sign inDemoInstall

detect-character-encoding

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

detect-character-encoding

Detect character encoding using ICU.


Version published
Weekly downloads
5.3K
increased by10.99%
Maintainers
1
Weekly downloads
 
Created
Source

detect-character-encoding

Node.js package Linux Build Status

Detect character encoding using ICU.

Getting started

Install using:

$ npm install detect-character-encoding --save

Use it like this:

var fs = require('fs');
var detectCharacterEncoding = require('detect-character-encoding');

var fileBuffer = fs.readFileSync('file.txt');
var charsetMatch = detectCharacterEncoding(fileBuffer);

console.log(charsetMatch);
// {
//   encoding: 'UTF-8',
//   confidence: 60
// }

Supported environments

detect-character-encoding should work fine on:

  • Ubuntu 12.04 x64
  • Ubuntu 14.04 x64
  • Debian 7 x64
  • OS X 10.9

You may currently encounter issues on 32-bit systems and Windows.

Supported character sets

As listed in ICU’s user guide:

  • UTF-8
  • UTF-16BE
  • UTF-16LE
  • UTF-32BE
  • UTF-32LE
  • Shift_JIS
  • ISO-2022-JP
  • ISO-2022-CN
  • ISO-2022-KR
  • GB18030
  • Big5
  • EUC-JP
  • EUC-KR
  • ISO-8859-1
  • ISO-8859-2
  • ISO-8859-5
  • ISO-8859-6
  • ISO-8859-7
  • ISO-8859-8
  • ISO-8859-9
  • windows-1250
  • windows-1251
  • windows-1252
  • windows-1253
  • windows-1254
  • windows-1255
  • windows-1256
  • KOI8-R
  • IBM420
  • IBM424

Release history

  • v0.2.0 (2015-09-15): Add support for Node.js v4.
  • v0.1.0 (2015-03-15): Initial release.

License

detect-character-encoding is licensed under the BSD 2-clause license, subject to additional terms. See LICENSE for the full license text.

Keywords

FAQs

Package last updated on 15 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc