Anchor tag with download prop skips contents after #039; character

Viewed 17

I'm using an anchor tag to export my data to a csv file:

  <a href="data:text;charset=utf-8,1,2,3,4,5" download="myfile.csv">Download</a>

But sometimes there is a ' character in the data that is escaped to #039. If so, the file after this character is not exporting! Example:

<a href="data:text;charset=utf-8,Start #039; This will be skipped" download="myfile.csv">Download</a>

You can see this bug here: https://jsfiddle.net/rostamiani/xswar3fj/

  • How can I avoid this problem without changing the data source?
  • Why this happens and how to avoid?
  • Is there any other characters like this?

UPDATE:

The problem is not #039 character, it's exactly #.

See the new example: https://jsfiddle.net/rostamiani/xswar3fj/2/

0 Answers
Related