Sha256: b1d1a081061fa4a28a97295cb09bc0aa077acbe89edff7e04f7a3efe5773ee61

Contents?: true

Size: 1.64 KB

Versions: 28

Compression:

Stored size: 1.64 KB

Contents

iconv-lite - native javascript conversion between character encodings.
======================================================================

## Usage

    var iconv = require('iconv-lite');
    
    // Convert from an encoded buffer to string.
    str = iconv.fromEncoding(buf, 'win-1251');
    // Or
    str = iconv.decode(buf, 'win-1251');
    
    // Convert from string to an encoded buffer.
    buf = iconv.toEncoding("Sample input string", 'win-1251');
    // Or
    buf = iconv.encode("Sample input string", 'win-1251');

## Supported encodings

Currently only a small part of encodings supported:

*   All node.js native encodings: 'utf8', 'ucs2', 'ascii', 'binary', 'base64'.
*   'latin1'
*   Cyrillic encodings: 'windows-1251', 'koi8-r', 'iso 8859-5'.

Other encodings are easy to add, see the source. Please, participate.


## Encoding/decoding speed

Comparison with iconv module (1000 times 256kb, on Core i5/2.5 GHz).

    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


## Notes

This module is JavaScript-only, thus can be used in a sandboxed environment like [Cloud9](http://c9.io).

Untranslatable characters are set to '?'. No transliteration is currently supported, pull requests are welcome.

## Testing

    npm install --dev iconv-lite
    vows

## TODO

*   Support streaming character conversion, something like util.pipe(req, iconv.fromEncodingStream('latin1')).
*   Add more encodings.
*   Add transliteration (best fit char).
*   Add tests and correct support of variable-byte encodings (currently work is delegated to node).

Version data entries

28 entries across 21 versions & 4 rubygems

Version Path
hooch-0.4.2 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.4.1 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.4.0 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-livereload/node_modules/tiny-lr/node_modules/body-parser/node_modules/iconv-lite/README.md~
gulp_assets-1.0.0.pre.4 template/node_modules/gulp-livereload/node_modules/tiny-lr/node_modules/body-parser/node_modules/iconv-lite/README.md~
gulp_assets-1.0.0.pre.3 template/node_modules/gulp-livereload/node_modules/tiny-lr/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.3.0 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.2.1 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.2.0 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.1.0 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.0.8 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.0.7 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
hooch-0.0.6 jasmine/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
entangled-0.0.16 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
entangled-0.0.16 spec/dummy/public/node_modules/grunt/node_modules/iconv-lite/README.md~
entangled-0.0.15 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
entangled-0.0.15 spec/dummy/public/node_modules/grunt/node_modules/iconv-lite/README.md~
entangled-0.0.14 spec/dummy/public/node_modules/karma/node_modules/connect/node_modules/body-parser/node_modules/iconv-lite/README.md~
entangled-0.0.14 spec/dummy/public/node_modules/grunt/node_modules/iconv-lite/README.md~
entangled-0.0.13 spec/dummy/public/node_modules/grunt/node_modules/iconv-lite/README.md~