3

I have some Arabic text that needs to be displayed in my php file - but the characters are not recognized.

How do I create a document with Arabic support?

Zebra
  • 3,858
  • 9
  • 39
  • 52
  • "the characters are not recognized" - what does that mean? A proper browser will happily display an HTML page, if it's UTF-8 encoded and you tell the browser so. UTF-8 can encode all Unicode characters, including Arabic. – MSalters Jan 18 '11 at 13:07

2 Answers2

4

Ensure that you're using UTF-8 charset all the way. UTF-8 supports all characters the world is aware of. Save the PHP file as UTF-8. Set the DB table charset to UTF-8. Set the DB connection charset to UTF-8. Set the HTTP response header charset to UTF-8. See also PHP UTF-8 cheatsheet.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • 4
    That’s a bit idealistic. While it is indeed true that any UTF encoding (Unicode Transform Function, including UTF-8, UTF-16, and UTF-32) supports all possible Unicode code points, Unicode does not itself “support all characters that the world is aware of.” The world is a very big place, and its imagination is unbounded. That said, Unicode does indeed support a heck of a lot of them, many — perhaps even most — of which few people have ever heard of, with more constantly being added. If they were all already there, there’d be no need to keeping adding more. :) – tchrist Jan 18 '11 at 14:07
4

Problem will be here that your browser is not capable due to a necessary font or character table which is not being used. Have a look at this testpage in order to find out if your browser is capable of displaying arabic characters with its actual setting.

This page covers the necessary browser settings to display arabic characters.

Thariama
  • 50,002
  • 13
  • 138
  • 166