Question

I am a PHP Developer and Recently I develop a web site using PHP and I connect to a Syabse Database using ODBC.

My database connection is ok and I can display the data in my web pages but I face a problem when arabic data is displayed as it is viewed as squares and not understanding symbols.

I can not change the Database language encoding and it is correct as some other arabic data is displayed well.

I tried the same configuration used in that web page but it does not work too.

I read many realted problems and I tried some solutions and I read about UTF-8, ISO, Windows and Unicode langauge Encodings and I tried to change the HTML Meta tag to display the arabic words but the problem is not solved.

I think my PHP file language Encoding itself may have a problem. Can I change the PHP file language Encoding ? How to do that if it is possible ?

Is there any solution to dispaly Arabic coming from Database well in PHP web pages ? It is a boring problem :(

I will appreciate any hint or suggestion to solve that problem but please mention your reference and put and example if it is available.

Thanks in Advance...

Was it helpful?

Solution

Just changing the Meta tag isn't enough.

Assuming you want to change your environment to UTF-8, you need to make sure that the following is UTF-8 encoded:

  • The database tables
  • The database connection.
  • The page's encoding (in the Meta tag, or preferably the content-type header)

the PHP file's encoding is irrelevant, unless it contains non-ASCII content itself. In that case, you need to adjust its encoding as well, usually in your IDE's "Save as" dialog.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top