1

When I write text in cyrillic to my DB something like this:$var = 'ЖЌЧЃШ' it appears all scrambled in phpMyAdmin.

Like this:

So I checked the encoding in phpMyAdmin, it's utf8_bin.

My script contains header('Content-Type: text/html; charset=utf-8'); so I really don't know what else to do. I've checked other articles here, those I did suggested adding the header. I already have it.

What else could be causing this?

Nikk
  • 7,384
  • 8
  • 44
  • 90
  • Check out http://stackoverflow.com/questions/12534930/mysql-utf-8-character-insert-issue I believe you need a `mysql_query('set names utf8');` after you open your connection. So like, PHP needs to be set to UTF8 in the header (which you did). The mysql connection needs to be set to utf8, which is at that link, and the table receiving the data needs to be set to utf8 (which you did). – JNevill Apr 12 '16 at 18:56
  • 1
    Possible duplicate of [UTF-8 problems PHP/MySQL](http://stackoverflow.com/questions/4623733/utf-8-problems-php-mysql) – trincot Apr 12 '16 at 19:11
  • 1
    Possible duplicate of [UTF-8 all the way through](http://stackoverflow.com/questions/279170/utf-8-all-the-way-through) – miken32 Apr 12 '16 at 20:05

1 Answers1

1

This did the trick:

$mysqli->set_charset("utf8");

Nikk
  • 7,384
  • 8
  • 44
  • 90