views:

79

answers:

5

i have a website in which i have to put some lines in Arabic.... how to do it...

where to get the Arabic text characters... how to make the page support Arabic...

i have to put a line per page and there is a lotta lotta pages so can't go around making images and putting them...

alt text

A: 

If you don't even know where to get Arabic characters, but you want to display them, then you're doing something wrong.

Save files containing Arabic characters with encoding UTF-8. A good editor allows you to set the character encoding. In the HTML page, place the following after <head>:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">

If you're using XHTML:

<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />

That's it.

An alternative way (without messing with the encoding of a file), is using HTML escape sequences. This website does that jobs for you: http://www.htmlescape.net/

Lekensteyn
didn;t work....
Junaid Saeed
What 'does not work'? Example here: http://lekensteyn.nl/test-arabic.html
Lekensteyn
do you see arabic........... see the question again... thats what arabic looks like
Junaid Saeed
Yes I see arabic... Put an alternative way in my answer. Please review it.
Lekensteyn
THE "alternative" way in your question is called "Roman ($language)"Roman Arabic, Roman French, Roman Urdu....Roman French: bonjour (hello)Roman Arabic: Ahla (hello)Roman German: Hallo \ Gutan Tag (hello)
Junaid Saeed
+1  A: 

The W3C has a good introduction.

In short:

HTML is a text markup language. Text means any characters, not just ones in ASCII.

  1. Save your text using a character encoding that includes the characters you want (UTF-8 is a good bet). This will probably require configuring your editor in a way that is specific to the particular editor you are using. (Obviously it also requires that you have a way to input the characters you want)
  2. Make sure your server sends the correct character encoding in the headers (how you do this depends on the server software you us)
  3. If the document you serve over HTTP specifies its encoding internally, then make sure that is correct too
  4. If anything happens to the document between you saving it and it being served up (e.g. being put in a database, being munged by a server side script, etc) then make sure that the encoding isn't mucked about with on the way.

You can also represent any unicode character with ASCII

David Dorward
+1  A: 

You not only have to put the meta tag, telling that it is UTF-8 but really make the document UTF-8. You can do that with good editors (like notepad++) by converting them to "unicode" or "UTF-8 without BOM". Than you can simply use arabic characters

As this page is UTF-8, here are some examples (I hope I don't write anything rude here): شغف

If you use a server side scripting language make sure that it does not output the page in a different encoding. In PHP e.g. you can set it like this:

header('Content-Type: text/html; charset=utf-8');
Kau-Boy
Hey, I just copy-pasted some characters and wrote "Passion". Now you know how I feel about that page :)
Kau-Boy
+1  A: 

Won't you need the ensure the area where you display the Arabic is Right-to-Left orientated also?

e.g.

<p dir="rtl">
Jimmy C
+ <p dir="rtl" lang="AR"> رَبٍّ زِدْنٍي عِلمًا </p>+ convert the document to UTF-8
Junaid Saeed
A: 

this is the answer that was required but everybody answered only part one of many

  • Step 1 - You cannot have the multilingual characters in unicode document.. convert the document to UTF-8 document

    advanced editors don't make it simple for you... go low level... 
    use notepad to save the document as meName.html & change the encdoing 
    type to UTF-8
    
  • Step 2 - Mention in you html page that you are going to use such characters by

    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    
  • Step 3 - When you put in some characters make sure your container tags have the following 2 properties set

    dir='rtl'
    lang='ar'
    
  • Step 4 - Get the characters from some specific tool\editor or online editor like i did with Arabic-Keyboard.org

example

<p dir="rtl" lang="ar" style="color:#e0e0e0;font-size:20px;">رَبٍّ زِدْنٍي عِلمًا</p>

NOTE: font type, font family, font face setting will have no effect on special characters

Junaid Saeed
p.s. collective knowledge
Junaid Saeed
What do you mean by "advanced editors don't do it"? Every editor I know of supports Unicode/UTF-8. That's on Windows at least...
Dean Harding
okay.... edited
Junaid Saeed