Skip to content

Instantly share code, notes, and snippets.

@breezewish
Created January 13, 2017 03:28
Show Gist options
  • Save breezewish/c81caa227287a302fd44ff5621fa5bb8 to your computer and use it in GitHub Desktop.
Save breezewish/c81caa227287a302fd44ff5621fa5bb8 to your computer and use it in GitHub Desktop.
Detect Charset and Convert to UTF-8
var Iconv = require('iconv').Iconv;
var jschardet = require('jschardet');
return new Iconv(jschardet.detect(buf).encoding, 'UTF-8//TRANSLIT//IGNORE').convert(buf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment