Reputation: 836
I am retrieving a string from a webpage via a web browser, however the text on the page has many quotation marks ' and ". I am trying to pull the webpage into a variable, then use the variable as the body of an email. Do I need to swap out every double quote for single quotes OR double up the quotes, or since it is from a web page -> into a string, will it be OK?
Upvotes: 0
Views: 256
Reputation: 201538
There is no need for any special handling of quotation marks. If you have a fragment (or all) of an HTML document as a string, you generally must not escape the Ascii quotation marks " and ', since they may have special meaning as attribute delimiters, as e.g. in <div class="foo">
and escaping them would change the meaning. Within element content, in textual HTML format, as opposite to the DOM, they could be escaped as "
and '
, but there is no need for that.
Upvotes: 1
Reputation: 3562
You don't need to escape any "quote" characters because you're not editing source code. It's all in memory.
If you want rendered html, do nothing, eg If you want <b>Bold</b>
to produce Bold.
If you want the markup to display in the email, eg <p>Text</p>
.
<
with <
>
with >
&
with &
Upvotes: 1