Posting and displaying French characters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
conundrum
Forum Newbie
Posts: 15
Joined: Sun Jun 29, 2003 12:18 pm
Location: Ontario, Canada

Posting and displaying French characters

Post by conundrum »

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?
ruchit
Forum Commoner
Posts: 53
Joined: Mon Sep 26, 2005 6:03 am

Post by ruchit »

use

Code: Select all

$val = htmlspecialchars($val, ENT_QUOTES, 'ISO8859-15');
Post Reply