Reputation: 697
I was using blob to write a file with javascript in the client side. Following is the code snippet I used:
var blob = new Blob(['hello'], {type: "text/plain;charset=utf-8"});
saveAs(blob, "path.m");
Unfortunately, there is a junk character at the beginning of the file as flagged by Matlab:
I don't know what this character is and how Blob is introducing them. But I need to fix it before I can generate an actual matlab .m file.
I request anybody who knows how to fix this to help me.
Thanks.
Upvotes: 2
Views: 270
Reputation: 697
I found the solution to this problem. I changed the character set from utf-8 to ISO-8859-1 as follows:
var blob = new Blob(['hello'], {type: "text/plain;charset=ISO-8859-1"});
and it solved the problem.
Upvotes: 1