Charset problem, Data from mysql appear wrongly

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex Sarafian

    Charset problem, Data from mysql appear wrongly

    Hello
    I have build an application with php/mysql on my localhost Windows XP
    (english)
    My application lets you select the language which at the moment is
    Greek and English.
    My application is working fine on both languages but when i uploaded
    it to a remote server greek doesn't work. Actually the greek that are
    stored in the DB come up wrongly.

    I have read many other posts regarding this problem and i have tried
    many things but none works.

    First of all, i have checked that both mysql servers have the same
    character_set and character_set variables, so the remote DB supports
    Greek.

    Here is the code that initializes the DBConnection

    $DBLink = mysql_connect($ DBHostIP,$DBUse rName,$DBPasswo rd)
    or die ("Could not connect on MySql Database");
    mysql_select_db ("sarafian_Agen da") or die("Could not select
    database");

    which resides in a function.
    This was the original code with which only on my server worked in
    conjuction with the correct character set in the header part of the
    produced html

    Having read some articles i decided to try this code in the function

    $DBLink = mysql_connect($ DBHostIP,$DBUse rName,$DBPasswo rd)
    or die ("Could not connect on MySql Database");
    mysql_select_db ("sarafian_Agen da") or die("Could not select
    database");

    mysql_query("SE T NAMES 'iso-8859-7'",$DBLink);
    ini_set('mbstri ng.internal_enc oding','iso-8859-7');
    ini_set('mbstri ng.http_input', 'iso-8859-7');
    ini_set('mbstri ng.http_output' ,'iso-8859-7');
    ini_set('mbstri ng.internal_enc oding','iso-8859-7');
    header("Content-type: text/html;charset=is o-8859-7");

    iso-8859-7 is the charcter set for greek.

    I have tried various combinations for the iso-8859-7 with utf-8 but i
    had no luck.

    I really cant understand the problem. The curious thing is that
    phpMyAdmin presents the data correctly.
    I have tried tracking down how it does it without succes. Both
    databases are above the 40010 version that phpadmin checks.

    Thank you very much
Working...