Page 1 of 1

html_entity_decode

Posted: Wed Apr 06, 2005 4:38 am
by daveluff
Hi there,
I'm not a php developer so please bear with me.
I am having trouble inserting french charachters into my mysql database.

I spoke to my hosting co and they recommended using html_entity_decode in my php forms.

Is this easy to do, I am simply recieving for vars from a flash file and i guess I need
to convert the utf setting of them. Does this sound like the right route?

Any ideas or guidance would be really appreciated,
Dave

Posted: Wed Apr 06, 2005 6:57 am
by Chris Corbyn
When you recieve the value, BEFORE adding it to the database use html_entities() to convert it to its &#xx; value.

This should also display in the web page too since HTML read entities and displays them fine. If you need to convert back to the prignal value for any reason use html_entity_decode() :wink:

Code: Select all

$safe_insert_value = html_entities($_POST['var']); //Convert to entity
EDIT | Sorry, that would be htmlentities() [No underscore like I posted above]

http://www.php.net/htmlentities