Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

— character showing instead of em dash (—)?

The code:

var blob;

blob = new Blob(file, {
  encoding: "UTF-8",
  type: "text/plain;charset=UTF-8"
});

saveAs(blob, "" + this._id + ".html");

It's strange if I imput an — in the textarea the download file shows a — (on Chrome) even though I specified the encoding and charset as UTF-8 (both textarea and html file viewed in the same browser). What could be the problem?

like image 542
alexchenco Avatar asked Oct 23 '25 00:10

alexchenco


1 Answers

That means you didn't decode the downloaded file; UTF-8 will encode the em-dash as three bytes. That means to read the downloaded file, you need to tell your editor (or whatever tool you use to read the file) that the file content is encoded as UTF-8.

like image 117
Aaron Digulla Avatar answered Oct 25 '25 14:10

Aaron Digulla



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!