I am trying to get files using file-system-access API and it works good using this code:
function Process_Files(files) {
[].map.call(files, async function (file, i) {
if (isDataFile(file.name)) {
let fileText = await file.text();
let filePath = await file.webkitRelativePath;
ProcessFileContents(await fileText,await filePath);
}
})
}
function DirectoryChose(event) {
let files;
event.stopPropagation();
event.preventDefault();
if (event.type === "change") {
files = event.target.files;
}
if (files) {
Process_Files(files)
}
}
dropArea.addEventListener("change", DirectoryChose);
the problem is when we have an ANSI encoded file then the German Characters like Ö, Ü, and Ä become � while it works perfect with UTF-8 encoded files.
I couldn't find anyway to read files using file.text()
in ANSI code
thanks for help