French characters
| From: | Don | Date: | Mon, 19 Oct 2009 12:57:53 +0000 |
| Subject: | French characters | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-299041@lists.php.net to get a copy of this message | ||
Hi,
I use PHP to read data form a mysql 5 table. allow the user to edit the data
and then update the table. I am having trouble with French characters.
Before the update: Pas de description détaillée
After the update: Pas de description détaillée
When I read from the table I wrap the data in the following:
// Stripslashes
if (!get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Convert all applicable characters to HTML entities
$value = htmlentities($value,ENT_COMPAT);
When I update to the table, I wrap in the following:
// Addslashes
if (!(get_magic_quotes_gpc())) {
$value = addslashes($value);
}
// Quote if not a number or a numeric string
if (!is_numeric($value)) {
$value = @mysql_real_escape_string($value);
}
I've tried playing with character sets to no avail. There mst be a
solution,
Thanks
Don