I'm trying to insert an hebrew value into my mysql db, instead of hebrew the values looks like that.
שדגשדכעשד
The collation of the table is latin1_swedish_ci by default, I tried also to change to utf-8_general_ci, hebrew_bin, hebrew_general_ci but the result is still the same.
In my code I'm using of course the meta tag to configure the charset:
<meta charset="UTF-8">
And before my php query I added this line:
mysql_query("SET NAMES utf8");
I'm viewing the result in the phpmyadmin.
I have solved my Hebrew language problem. It was a database and table row/field encoding issue. Here is the solution I used. I took help from another answer and the link is given below, in case anyone needs it.
utf8_general_ci
. utf8_general_ci
.In the PHP connection script put
header('Content-Type: text/html; charset=utf-8');
In the xhtml head tag put
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
If you are using MySQLi put this code in the connection script after selecting the database:
mysql_query("SET NAMES 'utf8'");
If you are using PDO, put
$conn->query("SET NAMES 'utf8'");
The first answer helped me and I took it from there
Check the collation_connection:
show variables like '%collation%'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With