I have taken over a site which has a french and english version. The person who enters info about products copies and pastes the french description from a word/excel/powerpoint page and pastes it into a textarea to be submitted to the database.
The former programmer was just grabbing the $_POST['description'] and inserting it into the database.
It seems to display properly in the browser when you view the product page.
The problem arises when you attempt to update the product. Even if you do not alter the description, when the form is submitted the description becomes garbled and full of odd characters.
The former programmer was using html_entity_decode($_POST['description']) to try to convert the submitted form data before updating the information in the database.
From what I read in the php manual it seems like the right thing to do, but perhaps the problem lies with the copy and paste approach at the initial insert?
Has anyone seen this type of situation before?
Posting and displaying French characters
Moderator: General Moderators
use
Code: Select all
$val = htmlspecialchars($val, ENT_QUOTES, 'ISO8859-15');