It is not natively supported in ng-file-upload but you can create it yourself. Hook into ngf-change this way:
ngf-change="checkEncoding($files, $file, $newFiles, $duplicateFiles, $invalidFiles, $event)"
Include encoding.js in your app. When the user select a .txt file, load the content of the file by FileReader and use encoding.js to test the encoding :
$scope.checkEncoding = function(files, file, newFiles, duplicateFiles, invalidFiles, event) {
if (!event.target.files) return
var testFile = event.target.files[0];
var reader = new FileReader();
reader.onload = function(e) {
var content = new Uint8Array(e.target.result);
var encoding = Encoding.detect(content);
if (encoding != 'UTF8') {
//alert to the user, reset the file ng-model whatever ...
}
}
reader.readAsArrayBuffer(testFile)
}
Here is a working plunkr -> http://plnkr.co/edit/1UM9NDpNgRbJ13R67xuf?p=preview