-1

Enviroment: Windows NT WSP-IIS24 6.1 build 7601 (Windows Server 2008 R2 Web Server Edition Service Pack 1) i586 running IIS with PHP 5.4 and MySQL 5.0.10. All text tables is set to UTF-8. mbstring is added to PHP and configured in php.

When I open the connectiton the the database I see to it that UTF-8 is the default.

I set UTF-8 in the header. Still all non US chars is made into ?.

What am I missing?

I should add that the text I retriving from the database is mandarin, russian, spansish among other languages.

swe_mattias
  • 621
  • 1
  • 8
  • 15
  • 1
    http://stackoverflow.com/questions/279170/utf-8-all-the-way-through – Mark Baker Jul 07 '15 at 14:45
  • I have seen that thread but it dint help, strangely. – swe_mattias Jul 08 '15 at 05:24
  • 1
    You will have to provide the info required to reproduce the issue. Also, you have multiple components involved here, which of them is at fault? – Ulrich Eckhardt Jul 08 '15 at 05:54
  • 1
    You will have to add a lot more detail with actual code samples to illustrate what you're doing. There is *some* problem *somewhere* in the details, but since you're not showing any details we can't really help you. – deceze Jul 08 '15 at 05:57

1 Answers1

0

Try using SET NAMES 'UTF8' after connecting to MySQL:

$con=mysqli_connect("host", "user", "pw", "db");
if (!$con)
{
    die('Failed to connect to mySQL: ' .mysqli_connect_errno());
}

/* change character set to utf8 */
if (!$con->set_charset("utf8")) {
    printf("Error loading character set utf8: %s\n", $con->error);
}

As the manual says:

SET NAMES indicates what character set the client will use to send SQL statements to the server... It also specifies the character set that the server should use for sending results back to the client.

user4035
  • 22,508
  • 11
  • 59
  • 94