I am using PHP/MySQL.
MySQL version 5.0.37-community-nt
My table is using UTF-8 and so are all the columns.
Earlier I had no problem inserting German characters into my table.
My webpage was charset=iso-8859-1 and I used mysql_query to do my queries.
Then I noticed that Portuguese characters (from a SELECT statement) were not displaying properly on the web pages. So I changed my webpage to use charset=utf-8 and I also added this line to my PHP code:
mysql_query(''SET NAMES 'utf8'", $conn);
After that, the German & Portuguese characters displayed OK.
But when I tried to insert German characters "Vordere Zollamtsstraße'', I get this error:
Error in SQL: insert into employer(EmployerName, CityID) values ("Vordere Zollamtsstraße'', '3278')
Incorrect string value: '\xDFe' for column 'EmployerName' at row 1
I have been searching the mysql and other websites for help but not much luck. Anyone had this problem before?
I tried add this line below the "SET NAMES" code:
mysql_query(''SET CHARACTER SET 'utf8'", $conn);
Then there was no error in the insert but the German characters became "Vordere Zollamtsstra?e''
Never mind. The problem was that I was passing in the German characters in the URL. Once I use POST to send the German characters, the UTF-8 kicked in and it is OK now.