Socket
Socket
Sign inDemoInstall

iconv-lite

Package Overview
Dependencies
0
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.4 to 0.2.0

encodings/singlebyte.js

4

index.js

@@ -57,6 +57,2 @@ // Module exports

base64: "internal",
latin1: {
type: "internal",
originalEncoding: "binary"
},

@@ -63,0 +59,0 @@ // Codepage single-byte encodings.

{
"name": "iconv-lite",
"description": "Convert character encodings in pure javascript.",
"version": "0.1.4",
"version": "0.2.0",

@@ -6,0 +6,0 @@ "keywords": ["iconv", "convert", "charset"],

@@ -1,4 +0,10 @@

iconv-lite - native javascript conversion between character encodings.
iconv-lite - pure javascript character encoding conversion
======================================================================
## Features
* Easy API.
* Works on Windows and in sandboxed environments like [Cloud9](http://c9.io) (doesn't need native code compilation).
* Faster than iconv (see below for performance comparison).
## Usage

@@ -9,26 +15,21 @@

// Convert from an encoded buffer to string.
str = iconv.fromEncoding(buf, 'win-1251');
// Or
str = iconv.decode(buf, 'win-1251');
str = iconv.decode(buf, 'win1251');
// Convert from string to an encoded buffer.
buf = iconv.toEncoding("Sample input string", 'win-1251');
// Or
buf = iconv.encode("Sample input string", 'win-1251');
buf = iconv.encode("Sample input string", 'win1251');
## Supported encodings
Currently the following encodings supported:
* All node.js native encodings: 'utf8', 'ucs2', 'ascii', 'binary', 'base64'
* Base encodings: 'latin1'
* Western encoding: 'windows-1252'
* Cyrillic encodings: 'windows-1251', 'koi8-r', 'iso-8859-5'
* Simplified chinese: 'gbk', 'gb2313'
* Greek encodings: 'windows-1253', 'iso-8859-7'/'greek', 'cp737', 'cp28597'
* Turkish encodings: 'windows1254', 'iso-8859-9'/'turkish'
* All widespread single byte encodings: Windows 125x family, ISO-8859 family,
IBM/DOS codepages, Macintosh family, KOI8 family.
Aliases like 'latin1', 'us-ascii' also supported.
* Multibyte encodings: 'gbk', 'gb2313'.
Other encodings are easy to add, see the source. Please, participate.
Others are easy to add, see the source. Please, participate.
Most encodings are generated from node-iconv. Thank you Ben Noordhuis and iconv authors!
Not supported yet: Big5, EUC family, Shift_JIS.
## Encoding/decoding speed

@@ -38,5 +39,6 @@

Operation\module iconv iconv-lite (this)
toEncoding('win1251') 19.57 mb/s 49.04 mb/s
fromEncoding('win1251') 16.39 mb/s 24.11 mb/s
operation iconv iconv-lite (this module)
----------------------------------------------------------
encode('win1251') 19.57 mb/s 49.04 mb/s
decode('win1251') 16.39 mb/s 24.11 mb/s

@@ -46,6 +48,4 @@

This module is JavaScript-only, thus can be used in a sandboxed environment like [Cloud9](http://c9.io).
Untranslatable characters are set to � or ?. No transliteration is currently supported, pull requests are welcome.
Untranslatable characters are set to '?'. No transliteration is currently supported, pull requests are welcome.
## Testing

@@ -52,0 +52,0 @@

@@ -14,3 +14,3 @@ var vows = require('vows'),

ascii: ascii,
greek: "€‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ",
turkish: "€‚ƒ„…†‡ˆ‰Š‹Œ‘’“”•–—˜™š›œŸ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ",
untranslatable: "\x81\x8d\x8e\x8f\x90\x9d\x9e"

@@ -21,3 +21,3 @@ },

ascii: new Buffer(ascii, 'binary'),
greek: new Buffer(
turkish: new Buffer(
'\x80\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c' +

@@ -39,6 +39,4 @@ '\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9f' +

ascii: ascii,
greek: "¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ",
untranslatable:
'\x80\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f' +
'\x90\x91\x92\x93\x94\x95\x96\x97\x98\x99\x9a\x9b\x9c\x9d\x9e\x9f'
turkish: "\xa0¡¢£¤¥¦§¨©ª«¬\xad®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖ×ØÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ",
untranslatable: ''
},

@@ -48,4 +46,4 @@ encodedStrings: {

ascii: new Buffer(ascii, 'binary'),
greek: new Buffer(
'\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xae\xaf' +
turkish: new Buffer(
'\xa0\xa1\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xab\xac\xad\xae\xaf' +
'\xb0\xb1\xb2\xb3\xb4\xb5\xb6\xb7\xb8\xb9\xba\xbb\xbc\xbd\xbe\xbf' +

@@ -63,3 +61,3 @@ '\xc0\xc1\xc2\xc3\xc4\xc5\xc6\xc7\xc8\xc9\xca\xcb\xcc\xcd\xce\xcf' +

var enc = encoding.variations[0];
var key = "greek";
var key = "turkish";
var tests = {

@@ -66,0 +64,0 @@ "Convert to empty buffer": function() {

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc