Created
December 25, 2014 13:11
-
-
Save typeofweb/a80e42c6fc57a18c18fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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