Jump to content

random symobols printed in html output


AdRock

Recommended Posts

I have noticed that today that some of the content that is saved from my form is printing random characters and crap.

 

I am using htmlentities on the form input and it seems to be adding more rubbish.

 

I am using the UTF-8 charset as a meta tag.

 

Is this the correct way of using htmlentities?

 

htmlentities($string,  ENT_QUOTES, 'UTF-8')

 

Also i noticed the other day with a problem I had that using htmlentities was replacing " with &" when i thought it should have just been "

Link to comment
Share on other sites

Make sure you use htmlentities() only once.  If you use it more than once on the same data, it will get corrupted.

 

I'm not sure from the post if you are clear on this, but htmlentities() is to encode data for inserting into the html output from your script.  It shouldn't be applied to input coming from a form, in usual circumstances.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.