Argh - is all I can say.
Working on a site hosted in the US with a multi-page form (8 pages worth) collecting tons of info that’s getting used internationally. I’m having a rough time trying to clean form input, handle foreign characters, and get it properly into MySQL and then back out again.
So, I’m trying to clean on-the-fly by looping through all my post variables.
Latest attempt:
[php]
foreach($_POST as $key=>$value){
if ($key!=“submit”){
$value = iconv(‘UTF-8’,‘ASCII//TRANSLIT’,$value);
$value = htmlentities(stripslashes(strip_tags($value)));
echo “\t<input type=“hidden” name=”$key" value="$value">\n";
}
}
[/php]
Still not working properly though.
Entering “Bénjamin” returns “B?njamin” for example.
All form pages are encoded:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
MySQL database is utf-8.
I’ve spent days researching and trying to find a good solution … and end up with hieroglyphics the moment there’s an odd diacritic typed in.
For example, early beta for the same above was generating "B����¯�¿�½���¯���¿���½����¯�¿�½������©njamin "
At least I’ve got less crap now!!!
I’ve just NOT found the magic formula yet. Can somebody point me to a definitive resource that explains exactly what I need to do, cause … ack!