Export to MS-Excel : Arabic character problem

friends, I am developing one application using php/mysql. I have to export some of the datas from my databse to excel format. Everything works fine untill I use arabic characters. When there are arabic words in the databse, it goes funny characters.

The code I am using is…

Please give a solution to this…

In Excel, are you using a unicode font? Try changing the font of the worksheet concerned to a font line Lucide Sans Unicode

Actually my problem is to export. I do not have a way to set up font styles. Only I can export raw datas.

What is the selected MySQL charset for the connection and on the server? What Collation are the database tables set to?

your old data inserted as Latin1 default … you can’t view it at all …

u must change ur DEFAULT CHARSET in Mysql to utf8

CREATE TABLE Tablename (
id int(11) NOT NULL auto_increment,
x varchar(50) default NULL,
xy varchar(50) default NULL,
xyz varchar(250) default NULL,
date timestamp NOT NULL default CURRENT_TIMESTAMP,

then in ur insert browser or whatever u must change the text to utf8 too


mysql_query(“set names utf8”);

good luck :slight_smile: