How will i find an aprostophe (single quote ) in jquery if user has in it's message . If it is there the replace or escape because sql server doesnot accept single quotes.
If message does not contain single quote the i want to send message as message because message may have image files , tables or videos .
i am trying this
var message = contents.replace(/[!'()*&"<>]/g, escape);
but it is saving like below in db & giving user
%3Cp%3Ethis isn%27t good it%27s not saving%26nbsp;%3C/p%3E
Also if i will not put a check then it saves the video's the same way
Please help

Kirtesh ShahRank #250 · 10K reputationPosted Jun 18, 2021, 12:05 PM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 18, 2021, 10:41 AM EDT
at first SQL Server does understand the single quote, you just need to replace the single quote to a double quote in order to consider it as a single quote by SQL server.
var message = contents.Replace("'","\"");
r k144 reputationPosted Jun 18, 2021, 11:04 AM EDT
Sachin SinghRank #66 · 26.2K reputationPosted Jun 18, 2021, 11:08 AM EDT