Answer the question
In order to leave comments, you need to log in
Angular how to solve encoding problem when saving file from request?
Good afternoon.
The task is this, I receive text from the server and save it in txt with windows-1251 encoding.
The problem is the following, the text comes from the server in windows-1251, and on the client, through the blob and the FIleSaver plugin , I save it to a file, but js will recode it all into utf-8.
An example of saving a file.
ApiAdmFinance.cashoutPaymentParams(params).then(function(res){
var data = new Blob([res.data], { type: 'text/plain;charset=windows-1251' });
FileSaver.saveAs(data, 'payment_orders.txt');
};
Answer the question
In order to leave comments, you need to log in
Сталкивался с подобной проблемой, решение описал в ответе на свой же вопрос.
https://qna.habr.com/q/582990
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question