I'm trying to insert text into a MySQL DataBase from a form using PHP.
Problem is, when I check the DataBase in phpmyadmin, I find that special characters like ü, ö, ä, è, é, à... are being corrupted, and I get things like üöäéèÃ.I've tried the following:
- Putting
accept-charset="latin1_swedish_ci"in the<form>tag - Setting
default_charset = "latin1_swedish_ci"in the php.ini file - Putting
mysqli_set_charset($dbc, 'latin1_swedish_ci');andmysql_query('SET NAMES latin1_swedish_ci');after themysqli_connect()function - Setting the collation of the DataBase, the table and the individual columns to
latin1_swedish_ci
I noticed that running the query directly in the phpmyadmin the values weren't corrupted, so I suppose the error must be somewere in the PHP and/or the MySQL connection.
Also, I tried doing the same with utf-8_general_ci, and obtained same results.
It seems to be ignoring anything I do.
Advice and ideas welcome. Thanks guys,
Sean
accept-charset="latin1_swedish_ci"is no valid HTML. Please use a fitting charset, see HTML docs. You might be looking forlatin1, list of all registered charsets.