0

How to use # in href without terminating rest of the link in link tag

Hi! So! I wants to use # symbol in the middle of text as link of a tag. Basically I'm trying to download a string using javascript which is just a csv string. I wants to download that string as a csv file. I'm using the code below to achieve that but symbole "#" is casing issue because it is terminating rest of the string because that is how href works csvContent = "data:text/csv;charset=utf-8,sep=;\r\n a;b;c#;d;e;f " var encodedUri = encodeURI(csvContent); window.location = encodedUri In above code, ";d;e;f" will be ignored and file will not be downloaded completely Can anyone please help me to download string which includes # in it as text file?

14th Aug 2022, 6:19 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
4 Answers
+ 1
@<DD> Thanks that worked. I encoded only string and that is now working perfectly
15th Aug 2022, 12:41 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar
0
@Mirielle I know that I can't use # inside url. But I was unable to find any solution which will encode string that # will not be in url. I needed to have # in the csv file Now i'm using encodeURIComponent which is working fine
15th Aug 2022, 12:43 PM
🌀 Shail Murtaza شعیل مرتضیٰ
🌀 Shail Murtaza شعیل مرتضیٰ - avatar