+ Reply to Thread
Results 1 to 8 of 8

Thread: displaying Arabic text using PHP

  1. #1
    basrah_university68 is offline x10Hosting Member basrah_university68 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    6

    displaying Arabic text using PHP

    Hi,

    I am trying to use Arabic text using PHP. for some reasone I get ????? ????? displayed.

    Displyaing text using HRML files works fine.

    I save the file as utf-8.

    For example, the test file below only displays ????

    "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";

    <HTML lang="AR-IQ" dir=rtl charset=UTF-8>
    <HEAD>";
    <meta http-equiv="Content-Language" content="ar-kw">
    <TITLE>My Website</TITLE>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <?
    echo "</HEAD>";
    echo "<BODY>";
    echo "<span lang='ar-kw'يبمشبمشنتيبنتئيةىوةرىئءؤرنسنن سنيبمنستي </span>";

    echo "<p> ننتا وءةؤىروءؤ رمنسيب </p>";


    echo "</BODY>";
    echo " </HTML>";
    ?>

  2. #2
    wazam199419 is offline x10Hosting Member wazam199419 is an unknown quantity at this point
    Join Date
    Aug 2010
    Location
    Wallasey
    Posts
    11

    Re: displaying Arabic text using PHP

    You could use something like this?

    PHP Code:
    <?php

    echo <<<EOF
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html>
    <head>
    <title>TITLE HERE</title>
    </head>
    <body>
    <p>Put what ever here.</p>
    </body>
    </html>
    EOF;
    ?>
    Also try changing the language via CPanel.
    Last edited by wazam199419; 12-04-2010 at 12:15 PM.

  3. #3
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: displaying Arabic text using PHP

    1. Don't use the short tags <? ?>. Use the full tags <?php ?>

    2. Remove the quotes and semicolon from the first line and others that are outside the php tags
    "<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">";

    3. Close the span tag <span lang='ar-kw'

    4. Make sure save the file with utf-8 encoding. You might be saving it with another coding.

    5. http://badges.x10.bz/arabic.php shows that it can work.
    Last edited by descalzo; 12-04-2010 at 12:29 PM.
    Nothing is always absolutely so.

  4. #4
    wazam199419 is offline x10Hosting Member wazam199419 is an unknown quantity at this point
    Join Date
    Aug 2010
    Location
    Wallasey
    Posts
    11

    Re: displaying Arabic text using PHP

    There's nothing wrong using short tags. It doesn't effect the file at all.

  5. #5
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: displaying Arabic text using PHP

    Quote Originally Posted by wazam199419 View Post
    There's nothing wrong using short tags. It doesn't effect the file at all.
    While it isn't a problem in this case, their use is deprecated and some setups they are turned off. Using the full tags is just a good habit to get into.
    Nothing is always absolutely so.

  6. #6
    basrah_university68 is offline x10Hosting Member basrah_university68 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    6

    Re: displaying Arabic text using PHP

    Thanks you all for your answers.

    I updated the code to:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

    <HTML lang="AR-IQ" dir=rtl charset=UTF-8>
    <HEAD>
    <meta http-equiv="Content-Language" content="ar-kw">
    <TITLE>My Website</TITLE>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </HEAD>
    <BODY>
    <?php

    echo "<p> ننتا وءةؤىروءؤ رمنسيب </p>";

    ?>
    </BODY>
    </HTML>

    THis is saved as utf-8.

    still the browser display ??????

    when I remove the PHP section and pust instead of that <p> ننتا وءةؤىروءؤ رمنسيب </p> then save the file as HTML. then it displays the text correctly.

    I do dnot have this kind of problem on other free webhosting. The only think I did not like there was they add alot of adds to my page.

  7. #7
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: displaying Arabic text using PHP

    Did you click on the link I posted?

    That page is hosted on x10hosting. So it is not the server or the hostings fault.

    Again, go to cPanel-->File Manager.
    Create a new file.
    Open it in the regular Editor.
    Change the encoding to utf-8 and click on 'open'
    Code the page
    Save
    View.
    Nothing is always absolutely so.

  8. #8
    basrah_university68 is offline x10Hosting Member basrah_university68 is an unknown quantity at this point
    Join Date
    Nov 2010
    Posts
    6

    Re: displaying Arabic text using PHP

    Thanks Descalzo,

    I followed your instructions. I deleted the file on the server.

    This time I used cPanel to create a new file, then copy and pasted the contnt from the file I had on my PC to the file in File Manager. Save it as utf-8. It worked.

    I don't understand why this needs to be done using cPanel. Usually I create the file on my PC, then use a FTP program to uopload the file.

    Now I know how to do this work on this site.

    Thanks

+ Reply to Thread

Similar Threads

  1. arabic
    By gyauderman51 in forum Free Hosting
    Replies: 2
    Last Post: 08-27-2010, 02:43 PM
  2. cPanel is in arabic...
    By newtown11 in forum Free Hosting
    Replies: 2
    Last Post: 01-19-2010, 07:18 PM
  3. Please add the Arabic language
    By ilyas1990 in forum Feedback and Suggestions
    Replies: 6
    Last Post: 10-29-2007, 10:52 AM
  4. arabic language
    By tarbea in forum Feedback and Suggestions
    Replies: 2
    Last Post: 10-16-2007, 07:48 AM
  5. About Arabic Lang
    By kmbosha in forum Free Hosting
    Replies: 4
    Last Post: 08-24-2007, 01:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers