Skip to content

Instantly share code, notes, and snippets.

Avatar

Wenxuan breeswish

View GitHub Profile
@breeswish
breeswish / iconv.js
Created Jan 13, 2017
Detect Charset and Convert to UTF-8
View iconv.js
var Iconv = require('iconv').Iconv;
var jschardet = require('jschardet');
return new Iconv(jschardet.detect(buf).encoding, 'UTF-8//TRANSLIT//IGNORE').convert(buf);