loosecannon1
Programmer
I have a CGI process that dynamically populates an html form with parsed data from other html files.
Everything works fine except when the data contains double quotes.
My O’Reilly book says, “Double-quote characters may be contained within strings delimited by single-quote characters, and single-quote characters may be contained within strings delimited by double quotes.”
My problem is that the string may contain BOTH!
I’ve even tried to regex the string for ’ and replace with \’, but I still get an error
So my question is, “How can I display a string that has both single and double quotes in it?”
<script language="javascript">
var text = "'single' and “double” quotes";
alert(text);
</script>
Thanks!
Everything works fine except when the data contains double quotes.
My O’Reilly book says, “Double-quote characters may be contained within strings delimited by single-quote characters, and single-quote characters may be contained within strings delimited by double quotes.”
My problem is that the string may contain BOTH!
I’ve even tried to regex the string for ’ and replace with \’, but I still get an error
So my question is, “How can I display a string that has both single and double quotes in it?”
<script language="javascript">
var text = "'single' and “double” quotes";
alert(text);
</script>
Thanks!