Arabic character encoding problem in the mailling

Discussion in 'PHP' started by crazy.works, Feb 28, 2009.

  1. #1
    Hi All,
    hello,
    i wanna put milling notification service in my site , so i got nice code , but it succeed with the English letters only , and with the other languages it delivered the message with encoding like �בַד והַ عزيزي عضو كليبسر

    so here is my code and please help me to fix that , thanks .

    
    <?
    
         $message  = "-- this is my message --\n";
         $message .= " welcome dude \n";
         $message  = "-- this is my message --\n";
    
         $recipient = "$email";
         $subject = " my subject here ! ";
         $from = $_SERVER['HTTP_HOST'];
         $headers = "From: $sitename ($sitelink) <mailer@$from>";
         $headers .= "MIME-Version: 1.0\n";
    
        mail($recipient,$subject,$message,$headers);
    
    ?> 
    
    PHP:
     
    crazy.works, Feb 28, 2009 IP
  2. crazy.works

    crazy.works Peon

    Messages:
    304
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    thanks fixed $headers .="Content-Type: text/html; charset=\"windows-1256\"";
     
    crazy.works, Feb 28, 2009 IP
  3. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #3
    Bad idea. Always use UTF8 for non-latin characters. It is the standard.

    Peace,
     
    Barti1987, Feb 28, 2009 IP