Read HTML file using fs.read in UXP (UTF-8 format)
Hi All,
I'm using the UXP script to read the HTML file from the local folder. But I'm unable to read the file with UTF-8 format.
//=========================================
let myInDesign = require("indesign");
let app = myInDesign.app;
const uxpfs = require("uxp").storage;
const ufs = uxpfs.localFileSystem;
const ufs_frm = require('uxp').storage.formats;
var fs = require('fs');
const file = await ufs.getFileForOpening({mode: uxpfs.modes.readWrite, type: "file"});
if (!file) {
// no file selected
return;
}
var manifest_str = fs.readFileSync(file);
const myNovel = await file.read({format: formats.utf8});
if (window.DOMParser) {
const parser = new DOMParser();
var manifest = parser.parseFromString(manifest_str, "text/xml");
}
//=========================================
Kindly suggest any one, will appriciate.
