ashtuchkin/iconv-lite — pull request #1 by jenkinv (2011-11-23 07:54:51+00:00)
Title: gbk,gb2312 encoding for Simple Chinese language supported

'iconv-lite' is awesome!
I met the problem that node.js don't support 'new Buffer(mystring, myencoding) or mybuffer.toString(myencoding)' when i prepared to parse GBK file in my job.Then, i found 'iconv' module which have to depend on iconv command line in linux environment. It works fine ,but i have to run my code in windows 7 where 'iconv' cann't compile . So, i found 'iconv-lite' and got an insight into the problem.
Now, i finished the just-work version with GBK encoding in my fork from iconv-lite.So i 'Send pull request' to u.
I add a table method in index.js. It can translate one encoding to any other encoding through table-data in 'encodings/table' directory.table-data is key-value struct,key is the code want to decode, value is matched unicode.table-data now only support ucs2 unicode ,max value is 0xFFFF.the gbk.js in encodings dirctory just mapped GBK/GB2312 encoding with table-data and decode function.

And then, i meet a question that encodings's method name 'toEncoding/fromEncoding' lead to
a litter confusion for me. I mean it when i look at the code .I suggest 'encode(str,encoding) / decode(buffer,encoding)' which corespond to ' new Buffer(str, encoding)/ buffer.toString(encoding)'