Skip to content

Instantly share code, notes, and snippets.

@mmiszy
Created December 25, 2014 13:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mmiszy/a80e42c6fc57a18c18fc to your computer and use it in GitHub Desktop.
Save mmiszy/a80e42c6fc57a18c18fc to your computer and use it in GitHub Desktop.
var fileName = process.argv[2];
if (!fileName) {
console.error('No file input!');
return;
}
var Iconv = require('iconv').Iconv;
var fs = require('fs');
var charsetConverter = new Iconv("cp1250", "utf8");
fs.readFile(fileName, function (err, fileContent) {
if (err) {
throw err;
}
fs.writeFile(fileName, charsetConverter.convert(fileContent), function (err) {
if (err) {
throw err;
}
console.log('Done!');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment