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));
1
  • 1
    Many years ago, PHP decided to deprecate the mysql_ API. So it's nice that it's making a comeback. Commented Mar 12, 2015 at 19:19

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.