0

OK, I need help!!!!!!! I've tried every advice I could find on google, nothing works for me!!!!!
my DB has data in hebrew
I can't figure out how to set the collation and everything else right so that my site would show the data in hebrew when I echo it from the DB. I tried every collation possible urg!!
utf8_general_ci
hebrew_bin
hebrew_general_ci
utf8_bin

I tried to change the Meta in html to charset=utf-8 and charset=windows-1255
and nothing works!!! the best case was when the DB was hebrew_general_ci and charset was windows 1255..that way I saw hebrew text on my page (static text) and what's echoed from the DB was '????'
any other combination of settings just made it worst, I either don't see even static text, or it's something like 235g4hj5ghj34g6 in the DB

my PhpMyAdmin is 3.3.9. it says- Server version: 5.5.8, MySQL charset: UTF-8 Unicode (utf8)
I use the localhost XAMPP(the site is not on a host server)

please help me I gotta make it work!!!!
can someone send me a simple php file with all the right setting in the head/meta/header()and guide me on how to set the db right????

I'm using this simple code to test..
I want to see on the page something like this:
עברית
123 שדג
234 דדגקקרכנ

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="rtl">
<?php
header('Content-Type: text/html; charset=utf-8');
?>
<head>
	<title>Index</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body rightmargin="0" topmargin="0" bgcolor="#96928F">
	<div> עברית </div>
<?php
$dbc = mysqli_connect('localhost', 'root', '', 'hebDB')
	or die('Error connecting to MySQL server.');
mysql_set_charset('utf8',$dbc); 
$query = "SELECT * FROM tblheb";
$result = mysqli_query($dbc, $query)
  or die('Error querying database.');
while ($row = mysqli_fetch_array($result)){				
	echo $row['id'].' '.$row['name'].'<br/>';
}
?>
</body>
</html>

Edited by 54uydf: n/a

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by 54uydf
0

AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
after 3 days I figured it out!!
for future victims of this problem here's what I did to make it work-

and thanks to this vid http://www.youtube.com/watch?v=tEfWTFTJ0vI

created the DB in PHPMYADMIN set:
collation- utf8_unicode_ci
MySQL connection collation: utf8_unicode_ci

when creating a table I set the collation there as well to utf8_unicode_ci

it also worked on a DB I created with collation hebrew_general_ci..or bin..I'm not sure
in php code-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html dir="rtl">
<?php
header('Content-Type: text/html; charset=windows-1255');
?>
<head>
	<title>Index</title>
	<META content="text/html; charset=windows-1255" http-equiv=Content-Type>
</head>
<body rightmargin="0" topmargin="0" bgcolor="#96928F">
	<div><h1> עברית </h1></div>
<?php
$link = mysql_connect('localhost', 'root', '', TRUE)
	or die('Error connecting to MySQL server.');
//$db_selected = mysql_select_db('hebDB',$dbc);
mysql_selectdb('hebDB',$link)or die('Error selecting to MySQL server.');

mysql_set_charset('[B]hebrew[/B]', $link) or die ('CANTTTTTTTTTTTT');

$query = "SELECT * FROM tblheb";
$result = mysql_query($query,$link)
  or die('Error querying database.');
while ($row = mysql_fetch_array($result)){				
	echo '<h1>'.$row['id'].' '.$row['name'].'</h1><br/>';
}
?>

</body>
</html>

don't know if it's the right way to do this..but it's working!!!!!!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.