Charset problem, Data from mysql appear wrongly

This is a discussion on Charset problem, Data from mysql appear wrongly within the PHP Language forums, part of the PHP Programming Forums category; Hello I have build an application with php/mysql on my localhost Windows XP (english) My application lets you select ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-21-2005
Alex Sarafian
 
Posts: n/a
Default 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,$DBUserName,$DBPassword)
or die ("Could not connect on MySql Database");
mysql_select_db("sarafian_Agenda") 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,$DBUserName,$DBPassword)
or die ("Could not connect on MySql Database");
mysql_select_db("sarafian_Agenda") or die("Could not select
database");

mysql_query("SET NAMES 'iso-8859-7'",$DBLink);
ini_set('mbstring.internal_encoding','iso-8859-7');
ini_set('mbstring.http_input','iso-8859-7');
ini_set('mbstring.http_output','iso-8859-7');
ini_set('mbstring.internal_encoding','iso-8859-7');
header("Content-type: text/html;charset=iso-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
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:55 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0