3
如何查找給定文本文件的字符編碼?nodejs獲取文件字符編碼
var inputFile = "filename.txt";
var file = fs.readFileSync(inputFile);
var data = new Buffer(file, "ascii");
var fileEncoding = some_clever_function(file);
if (fileEncoding !== "utf8") {
// do something
}
感謝
這正是我一直在尋找,謝謝:) – 6bytes