remove iconv dependency

This commit is contained in:
Michael Morrison 2013-07-10 07:20:05 -05:00
parent f062e03271
commit 27b09c37e4
2 changed files with 4 additions and 22 deletions

View File

@ -26,7 +26,7 @@
}
],
"dependencies": {
"iconv": ">=2.0.6",
"iconv-lite": ">=0.2.10",
"bignum": ">=0.6.1",
"async": ">=0.2.9",
"compressjs": ">=1.0.0"

View File

@ -1,23 +1,6 @@
var Iconv = require('iconv').Iconv,
var Iconv = require('iconv-lite'),
Bignum = require('bignum');
var Iconv_converters = {};
function getIconv(from) {
var to = 'utf-8';
var key = from+'---'+to;
if(!(key in Iconv_converters)) {
Iconv_converters[key] = new Iconv(from, to);
}
return Iconv_converters[key];
}
function Reader(query,buffer) {
this.query = query;
this.buffer = buffer;
@ -39,7 +22,7 @@ Reader.prototype = {
}
options.encoding = options.encoding || this.query.encoding;
if(options.encoding == 'latin1') options.encoding = 'windows-1252';
if(options.encoding == 'latin1') options.encoding = 'win1252';
var start = this.i+0;
var end = start;
@ -65,8 +48,7 @@ Reader.prototype = {
if(enc == 'utf8' || enc == 'ucs2' || enc == 'binary') {
out = out.toString(enc);
} else {
var converter = getIconv(enc);
out = converter.convert(out).toString();
out = Iconv.decode(out,enc);
}
return out;
},