How to write Urdu, Arabic or Persian text on Web


Languages like Arabic, Farsi and Urdu (AFU) use Arabic fonts and write from right to left rather than the usual left to write. To make any browser display text from the right side of the browser one has to define the following within the HTML tag

html dir=”rtl” lang=”ur”

The DIR tag defines the direction writing on the screen. RTL (Right to Left) or LTR (Left to Write). The LANG tag defines the language specified. In this case it is Urdu (ur).

Inside the HEAD tag we need to add the following meta tag to make it support UNICODE characters.

meta charset=”utf-8″

This tells the browser that non-ASCII characters can be expected and therefore should not garble up text when displaying. Wikipedia defines UTF-8 encoding as:

UTF-8 is an 8-bit variable-width encoding which maximizes compatibility with ASCII.UTF-8 uses one to four bytes per code point and, being compact for Latin scripts and ASCII-compatible, provides the de facto standard encoding for interchange of Unicode text.

And that’s it. Now whatever you write will be displayed properly in the browser. Here is verse from Faiz Ahmad Faiz’s epic poem, Tanhai


پھر کوی آیا دلزار، نہیں کوی نہیں
راہ رو ھوگا کہیں اور چلا جاے گا

Share Button

Leave a Reply