Is there any way in casperjs to specify the encoding when saving the html content of the page to the file? I saved in ANSI, but I need utf-8

casper.thenOpen(myurli, function(){ var page1 = this.getHTML(); fs.write(file_path, page1, 'wb'); }); 

    1 answer 1

    Yeah, you just have to look not in fs.write but in fs.open.

     var myFile = fs.open('/path/to/file', { mode: 'w', charset: 'UTF-8' }); 

    phantomjs - open ()