1

I have PHP script with UTF-8 encoding and database and tables in db with UTF8 encoding too (utf8_general_ci). But after build and exec mysqli query this strings are going to a wrong encoding and they looks like (in db) they need UTF-8 converting, so they're encoded to CP1252 or something like that. (I putting up a cyrillic strings).

code that I using to connect to db is here:

$db = new mysqli("localhost", "root", "", "nf");
$db->set_charset("utf8");

so as you see charset setted up is to utf8, and database are in utf-8 and tables too.

so IDK why and where strings are going to a wrong character set like they're converted to a CP1252 encoding for no reason.

What may reason to do this? what additional information I can provide?

Immortal666
  • 23
  • 1
  • 3
  • http://stackoverflow.com/questions/1650591/whether-to-use-set-names Possible duplicate of http://stackoverflow.com/questions/5187761/resolving-incorrect-character-encoding-when-displaying-mysql-database-results-af – HashSu Jul 15 '15 at 15:58

1 Answers1

0

Try this line:

mysql_query("SET NAMES 'utf8'");