0

When user enters from php page to mysql it makes wierd characters like Pyr«±n«±es, ????? etc, when typing ' æøå éá etc.

I have tried anything now.

  • PHP files is saved as UTF8 without bom.
  • Altered all tables, database and converted to UTF8
  • HTML META charset utf8
  • Form has "accept-charset="utf-8"
  • Right after connection: mysql_query SET NAMES UTF8
  • PHP Header with charset: utf-8

What to do? When it's going to database it makes those annoying characters.

Please help me.

  • 1
    Can you share the offending script and the expected result? – Jeff Puckett Jun 17 '16 at 20:14
  • http://stackoverflow.com/questions/9351694/setting-php-default-encoding-to-utf-8 – RomanPerekhrest Jun 17 '16 at 20:18
  • `SET NAMES UTF8` might not always do the trick, you might also need `mysql_set_charset('utf8')`. But this won't affect data already stored with a broken encoding. For that, you'll have to extract all the data, force it to UTF8 and then update it. – Qirel Jun 17 '16 at 20:27
  • @Qirel - do not use the `mysql_*` interface; use the `mysqli_*` interface. – Rick James Jun 20 '16 at 05:42
  • @Rick it's what OP used as an example ;) (with `mysql_query`) I'm well aware of its depreciation ;) – Qirel Jun 20 '16 at 10:31

0 Answers0