Skip to content

Instantly share code, notes, and snippets.

@siygle
Created October 4, 2012 06:36
Show Gist options
  • Select an option

  • Save siygle/3831835 to your computer and use it in GitHub Desktop.

Select an option

Save siygle/3831835 to your computer and use it in GitHub Desktop.
Convert Big5 to UTF8 using node-iconv
var http = require('http')
, Buffer = require('buffer').Buffer
, Iconv = require('iconv').Iconv;
var options = {
host: 'mis.tse.com.tw',
path: '/data/4930.csv?r=' + new Date().getTime(),
method: 'GET',
};
var iconv = new Iconv('Big5', 'UTF8');
var req = http.request(options, function(res) {
res.on('data', function(data) {
var buffer = iconv.convert(data);
console.log(buffer.toString('utf-8'));
});
});
req.end();
@pracio
Copy link

pracio commented Sep 10, 2013

Thanks for sharing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment