I have an HTML anchor link downloading a csv file. The problem I'm facing is that if there is a '#' symbol in the csv string (in the 'href' attribute) it is breaking the file at that point.
Is it breaking the file for some reason or is it reading it as the end of the file? I really don't know. I've tried escaping the character ('\#' instead of '#') but it just inputs the '\' and then breaks.
Thanks
****EDIT**** I am asking because I am trying to program this to work and am concerned that because certain fields may allow user input (hence, I cannot just avoid using '#') I may face this issue.
I am simply using html and a bit of javascript to create the string to download.
The '#' is breaking the file at that point. No new line, etc, everything after and including the '#' is not going into the file. I have viewed the file using Excel and also basic Notepad on windows. Thanks
****EDIT/EXAMPLE**** Sorry, the information is sensitive but I have included a simple example here.
This works fine:
<a class="download-link" download="test.csv" href="data:text/csv;charset=utf-8,col1h,col2h,col3h col1data,col2data,col3data">Downloads as expected</a>
This does not. Due to the '#' in 'col1data', the file, when downloaded, ends at 'col1datahasa'. The headers go in fine but everything after and including the '#' does not.
<a class="download-link" download="test.csv" href="data:text/csv;charset=utf-8,col1h,col2h,col3h col1datahasa#,col2datadontgetshown,col3datadontgetshown">Downloads with missing data</a>
If you copy the two links to a local file and run it you should see what I mean.