0

hey there i'm using mysql in hebrew , but when i try to preview the sql in the page , all i see is ????? ????? instead of my words

the code i'm using is the normal SELECT

$con = mysql_connect($server,$user,$pass);
    mysql_select_db($db,$con)
    or die ("no db");
    $query="SELECT `app_desc` FROM `apps` where `id`=$id";
    $result = mysql_query($query);

and i also tried to add

mysql_set_charset('windows-1255',$con);

or this

mysql_set_charset('utf8',$con);

also when i view it in PHPmyAdmin it shows as it should.

what do i need to do ?

also the database encoding is utf8_general_ci

and page encoding is utf-8


well i'm dumb.

thanks all for your answers.

the problem is that the DB encoding was UTF-8 but the table was latin

Eli Y
  • 877
  • 16
  • 41
  • Do not "try". But set the **actual** encoding your data in. – Your Common Sense Sep 02 '11 at 11:24
  • Where did you add mysql_set_charset()? You need to add it BEFORE you do anything with your database. – str Sep 02 '11 at 11:27
  • Even if you set utf8-encoding in the html, it does not guarantee that your page is encoded in utf8. You should check, what encoding your webserver (apache?) has set in the httpd.conf. You can use Firebug to check the http headers for the encoding. – Leif Sep 02 '11 at 11:28
  • How sure are you that encoding of the page is utf-8? – Rok Kralj Sep 02 '11 at 11:28
  • check my answer here: http://stackoverflow.com/questions/7278380/mysql-php-javascript-utf-8-problem-with-swedish-letters-everything-tested-no/7281080#7281080 – Cristi Pufu Sep 02 '11 at 11:32
  • @Cristi Pufu answer there is wrong while mysql_set_charset() is the only right way to set encoding – Your Common Sense Sep 02 '11 at 11:39
  • mysql_set_charset('utf8',$con); is same as SET NAMES equivalent. – Rok Kralj Sep 02 '11 at 11:40

1 Answers1

0

well i'm dumb.

thanks all for your answers.

the problem is that the DB encoding was UTF-8 but the table was latin

Eli Y
  • 877
  • 16
  • 41