asp classic - How to escape double quotes if the variable is coming from database? -
i know double quotes can escaped this:
string test = "he said me, ""hello world"". how you?"
or by:
string test = "he said me, \"hello world\" . how you?"
but don't want change value in database, want value database , put url. example :
href="http://www.abcd.com/movie/<%= mtitle%>/"
if string contains double quote breaks url.
in case you're not "escaping" quotes, you're url-encoding them. problem isn't string itself. problem many "special characters" have other meanings in context of url, or in way confuse parsing of url, , need encoded.
(in case, it's not url itself, html attribute being confused quotes.)
something this:
<a href="http://www.abcd.com/movie/<%= server.urlencode(mtitle) %>">
so instead of output:
<a href="http://www.abcd.com/movie/a"quoted"string">
you'd this:
<a href="http://www.abcd.com/movie/a%22quoted%22string">
Comments
Post a Comment