Hi
I’ve never paid much attention to encoding or charsets, and I’m pretty sure I do not understand its workings 100% ?
I’ve always just gone with the default in php and mysql, which is iso-8859-1.
But now there’s an external server which apparantly is posting to some of my scripts in utf8. So the data looks pretty strange both on the webpage (page itself is utf8) when showing the post variables and in the database.
I was thinking I would loop through all post-vars and just do a utf_decode on them, since my own server is still posting with iso-8859-1 as I understand. I have a file that is included on all such scripts, and I just thought I’d add something there to decode the data. Maybe like this:
[code=php]
foreach ($_POST as $name=>$value){
$_POST[$name] = utf8_decode($value);
}
I’m not sure if that is the best way of doing this. I do not have to do this if the posted variables aren’t in utf8, so is there any way of detecting the encoding first?
Please advice
Thanks
Lubox