Hello Everyone,

I am developing a new website which shall provide a user interface of multiple languages; starting with English, Persian and Arabic (We are considering Russian and Hebrew in addition to other languages in the 2nd phase).

What I have done is to store a language code with the relevant charset and CSS filename in a table and based on the session variable and selected language, the the PHP code will issue a header command with the required charset,

header("Content-type: text/html; charset=windows-1256");

The issue is with the display of the arabic language encoding even though I have used the three possible charsets:

  • windows-1256
  • utf-8
  • iso-5988-6

by the using the UTF8, the site header displays properly, but the other parts shows wrong letters. By using the windows-1256, a part of the site display properly, but the title and others are not shown. The displayed data (correct on at this part) is being retrieved from mySQL DB.

BTW, I have added the following code after a successful connection to the database:

mysql_query("SET NAMES 'utf8'");
mysql_query('SET CHARACTER SET utf8');

I need to mention, that I am using "include" for some parts of the website.

Can you help me to change the charset for all the pages and parts and resolve this issue?

Thanking you in advance,

Aziz

Recommended Answers

All 3 Replies

If you are using utf-8 in meta tag, mention that all source files should be also saved in utf-8.

commented: Simple and right to the point .. thank you so much. +1

If you are using utf-8 in meta tag, mention that all source files should be also saved in utf-8.

Yep. This has solved it for me! Simple things but wasted most of my day ..

Thank you very much ..

Aziz

Yep. This has solved it for me! Simple things but wasted most of my day ..

Thank you very much ..

Aziz

i have also same problem? how to solved your problem when change languages.....tel me plz?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.