Sunday 22 December 2019

javascript - how to display double quote instead of &34; from php variable

I am pulling my hair with this simple task...
From a php variable that contains double quotes (") which is echoed in a div, the html source shows that " have been replaced by ". So far OK.

However, when the html code within the div is copied with jQuery, some of the double quotes are repeated.
I need to fix that in order to use MindMup editor properly.



$Text = 'This is an example where double-quotes are added by "I don\'t know what".'
copy code

echo $Text;





If the text is typed directly into the html page with double quotes, then it is fine. See the difference in that example.



So my question is how do I stop php/html to convert the double quotes into " when displaying that variable in the page?




There is also an empty line added on top in the link above after copying the code... why?

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...