I use Angular 5 + "file-saver": "^1.3.3"
+ "@types/file-saver": "^1.3.0"
import { saveAs } from 'file-saver';
const filename = parts[1].split('=')[1];
const blob = new Blob(['\ufeff', response.body], { type: 'text/csv' });
saveAs(blob, filename);
create UTF-8 file
import { saveAs } from 'file-saver';
const filename = parts[1].split('=')[1];
const blob = new Blob([response.body], { type: 'text/csv' });
saveAs(blob, filename);
create UTF-8 w/o BOM file
But I need create ANSI file (for Excel and an other client)
I try { type: 'text/csv;charset=ansi;' }
but do not work.
it is not possible change UTF-8 to ANSI in Front-End part(Angular). I change
@RequestMapping(value = "/export", method = RequestMethod.GET, produces = "text/csv")
by
@RequestMapping(value = "/export", method = RequestMethod.GET, produces = "text/csv;charset=ISO-8859-1")
in my Back-End (Springboot)