0

When I insert hebrew it turns to גולדה מ×יר. I tried to add mysql_query( "SET CHARACTER SET utf8" ); to my code and its not working.

Here is part of my code:

header('Content-Type: text/html; charset=utf-8');  
mysql_query("SET character_set_client = utf8");
mysql_query("SET character_set_connection = utf8");
mysql_query("SET character_set_results = utf8");  
$insertUser = $odb -> prepare("INSERT INTO `users` VALUES(NULL, :username, :password, :email, 1, 0, 0, 0, '', 0, :Name, :school, :class, 3, 0)");
$insertUser -> execute(array(':username' => $username, ':password' => SHA1($password), ':email' => $email, ':Name' => $Name, ':school' => $school, ':class' => $class));
Tushar
  • 3,527
  • 9
  • 27
  • 49
Yuval
  • 15
  • 5

1 Answers1

1

It looks like the x-like character is the escape for the Hebrew plane. First look into: http://php.net/manual/de/function.utf8-decode.php.

Check the collation_connection:

show variables like '%collation%'

If utf8-decode doesn't work, one of the functions in the comments might do. Be sure to use a multibyte character set for PHP.

Also you can check; In the conn.inc.php file, after you selected a database and connected to it, do this:

if(!mysqli_set_charset($conn, 'utf8')) {
    echo 'the connection is not in utf8';
    exit();
}

and in the html always use charset utf-8;

If these things do not work for you; please google with hebrew in mysql stackoverflow; you will get lot of articles; which may solve your problem.

Also refer: UTF-8 all the way through

Community
  • 1
  • 1
Tushar
  • 3,527
  • 9
  • 27
  • 49