HTML Encoding
Posted: Tue Apr 06, 2010 7:47 am
Hi,
I have a scenario where I am expecting a user to enter HTML in a box. I then want to process this to make sure that if they have put special characters e.g. &, ", ' etc that these are correctly encoded. I cannot work out what to do because there is an htmlentities() function but this will also convert the "<" & ">" in the html tags e.g. "<span>". How do I only encode the text within the html tags?
My ultimate goal is to allow users to copy and paste from MS Word into an iframe which is editable. MS Word at the moment is putting the normal junk in when the users copy and paste and I need it cleaned.
Thanks in advance,
Lilalfyalien
I have a scenario where I am expecting a user to enter HTML in a box. I then want to process this to make sure that if they have put special characters e.g. &, ", ' etc that these are correctly encoded. I cannot work out what to do because there is an htmlentities() function but this will also convert the "<" & ">" in the html tags e.g. "<span>". How do I only encode the text within the html tags?
My ultimate goal is to allow users to copy and paste from MS Word into an iframe which is editable. MS Word at the moment is putting the normal junk in when the users copy and paste and I need it cleaned.
Thanks in advance,
Lilalfyalien