2

I can't save some special letters like german umlaut (ü) or croatian letters (ž,š,č) to the MySQL database.

This is what I have done so far:

  1. Database collation is set to utf8_general_ci
  2. Table collation is set to utf8_general_ci
  3. Row collation is set to utf8_general_ci
  4. In html meta tag is set to:
    <meta http-equiv='content-type'content='text/plain;charset=utf8_general_ci'>

  5. In html form I've set the attribute accept-charset="utf8_general_ci"

  6. in PHP I've set headers: header('Content-Type: text/plain; charset=utf8_general_ci');

  7. in PHP I've set mysql_set_charset ( "utf8_general_ci", $link );

I've been trying to solve this for days.. I also tried with utf8_unicode_ci.

What am I missing?

Isaac Bennetch
  • 11,830
  • 2
  • 32
  • 43
mirta
  • 644
  • 10
  • 25
  • 3
    Don't confuse [database charset with collation](http://dev.mysql.com/doc/refman/5.7/en/charset-database.html) – Mark Baker Dec 13 '16 at 09:22
  • 2
    Your charsets should be `utf8` (someplaces it needs to be `utf-8`), `utf8_general_ci` is not a charset. – Qirel Dec 13 '16 at 09:23
  • 1
    `utf8_general_ci` is used only in MySQL, in PHP header and HTML meta tag, use utf-8 only. – Anthony Dec 13 '16 at 09:25
  • thanks for pointing that out. I've changed it to utf-8 in both html and php, but in db i still get: ž for ž, ü for ü and so on.. – mirta Dec 13 '16 at 09:29
  • 1
    @mirta Have a look at this one http://stackoverflow.com/a/33906476/4535200 – Qirel Dec 13 '16 at 09:33
  • See "Mojibake" in http://stackoverflow.com/questions/38363566/trouble-with-utf8-characters-what-i-see-is-not-what-i-stored . – Rick James Dec 14 '16 at 01:41

0 Answers0