0

long time reader first time poster :-)

Hi,

i have a form that get all the info from flash and send the vars to php form all works well but hebrew.... i get some "jibrish"

other experiments i made shows:
a. if $content = "some hebrew characters";
embed heb-text in php works fine
however if it comes in a var it fails

any help is highly appreciated.


i saw other post but no one provided a firm solution:
http://www.daniweb.com/forums/thread15139.html
http://www.daniweb.com/forums/thread22253.html

my php code:

<?php
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .="Content-type: text/plain; charset=Windows-1252 \r\n";

$sendto = 'someOne@somesite.co.il';
$subject =  'Email from WebSite';
$name = $_POST['fromname'];
$from = $_POST['fromemail'];
$subSubject = $_POST['fromsubject'];
$message = utf8_decode($HTTP_POST_VARS['frommessage']);
$message = stripslashes($message);

$content = "Name: " . $name . "\n";
$content .= "Email: " . $from . "\n\n";
$content .= "Subject: " . $subSubject . "\n";
$content .= $message;


if(mail($sendto,$subject,$content))
{
 echo 'response=passed';
}
else
{
 echo 'response=failed';
}

?>
2
Contributors
9
Replies
10
Views
8 Years
Discussion Span
Last Post by omniuni
0

charset=Windows-1252 is a very non-standard encoding. I'm quite certain that the Hebrew characters are not supported. Try using UTF-8, the standard that PHP generally uses. The PHP files are UTF-8, hence why Hebrew in the PHP works.

0

great that did the trick.
thank you've been very helpful.

now i just have to figure out why its not accepting the "\n" sign. with UTF-8 all stays in the same line.... :-\

any quick solution?

again, thank you very much

0

thank you again for your fast replay
tried that with "\r", "\n" and "\r\n"
exp: $content = "Name: " . $name . "\r\n";

none of them works.........

0

What are you viewing the resulting eMail in? \r\n has always worked very reliably for me, using Mozilla Thunderbird, Inbox, and Gmail.

0

i think i have some syntax issue in my code but i can't spot it.
if i execute email function with no $headers i get the /n to work but i see gibrish for hebrew characters.

mail($sendto,$subject,$content)

when adding $headers i get the proper encoding but all in one line:

mail($sendto,$subject,$content, $headers)
<?php
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";


$sendto = 'email@gmail.com';
$subject =  'Email from  WebSite';
$name = $_POST['fromname'];
$from = $_POST['fromemail'];
$subSubject = $_POST['fromsubject'];
$message = $_POST['frommessage'];
$message = stripslashes($message);

$content = "Name: " . $name . "\n\r";
$content .= "Email: " . $from . "\n\n\r";
$content .= "Subject: " . $subSubject . "\n\r";
$content .= $message;

mail($sendto,$subject,$content, $headers)

?>
0

yorika! found it
in line 4 i set "text/html;" but it should be "text/plain;"

i feel like knocking my head in the wall........


thank so much omniuni you've been a great help.


cheers,
Daniel

0

No problem! Darn, can't believe I didn't see that myself! Good luck, and feel free to ask if you have any other interesting problems crop up!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.