PHP4 to PHP5 migration character encoding. latin1 vs utf8

947 Views Asked by At

I recently migrated from a PHP 4.3.9 / MySQL 4.1.22 setup to a PHP 5.3.3 / MySQL 5.1.69 setup. I seem to have a problem with character encoding. My database collation is latin1_swedish_ci.

Whenever I enter new data in my table through my PHP script, the data ends up garbled in MySQL , for example: à é ü ends up as à é ü.

I have tried setting the character set with mysql_set_charset or SET NAMES but neither seems to have any effect. I don't want to switch the table or code to utf8, I just want the current setup to work properly.

Already spend a couple of hours looking online and haven't found the solution yet.

All input is greatly appreciated.

tom

1

There are 1 best solutions below

0
On

Solved it by explicitly enabling: default_charset = "iso-8859-1" in php.ini Problem is now solved.