angular-file-saver icon indicating copy to clipboard operation
angular-file-saver copied to clipboard

Change the Format of Encoding/File

Open atodicebear opened this issue 9 years ago • 1 comments

Hey, How can I change the Encoding Format of the File I create with this package?

  data = new Blob([str], {
              type: 'application/json;charset=ansi;'
            });
            // Export "Download"
            this.FileSaver.saveAs(data, this.$scope.selectedLang[i].code + '.php');

Changing the charset to ansi instead of utf8 did nothing on the File, it is still UTF8. Even removing the whole option is not changing anything at all or Errors.

var data = new Blob([angular.toJson(res, true)]);//no option
            // Export "Download"
            this.FileSaver.saveAs(data, 'texte_' + this.$scope.selectedLang[i].pp_id + '.json');

I want to create 3 Files (.json->utf8/.php->ansi/.properties->ansi) Where can I tell Filesave in which Encoding Format it should be saved?

atodicebear avatar Sep 15 '16 13:09 atodicebear

I have the same problem:

const blob = new Blob(['\ufeff', response.body], { type: 'text/csv;charset=ansi;' });
saveAs(blob, filename, true);

with '\ufeff' => UTF-8 without '\ufeff' => UTF-8 w/o BOM

but I need ANSI

sgrillon14 avatar Dec 07 '17 17:12 sgrillon14