Forum Moderators: coopster

Message Too Old, No Replies

PHP send cyrilyc mail

How to make php not to escape cyrilic text

         

alex95_bg

8:44 pm on May 30, 2008 (gmt 0)

10+ Year Member



Hello, I'm having a problem sending multilanguage mail
Here's the code I'm using:

<?php

// if submitted form
if ($_SERVER['REQUEST_METHOD'] == "POST") {

// strip out HTML tags
$realname = strip_tags($realname);
$email = strip_tags($email);
$feedback = strip_tags($feedback);

// set the variables
$sendto = "myemail@myhost.com";
$subject = "Feedback recieved";
$message = "$realname, $email\n\n$feedback";
// send the email
mail($sendto, $subject, $message );

}

?>

<html>
<head>
<title>Feedback Form</title>
</head>
<body bgcolor="#FFFFFF">
<?php
if ($_SERVER['REQUEST_METHOD'] == "POST") {

$realname = $_POST['realname'];
$email = $_POST['email'];
$feedback = $_POST['feedback'];

echo("<p><b>Thank you for your feedback.</b></p>\n");
echo("<blockquote><pre>\n");
echo("$feedback");
echo("</pre></blockquote>");
}
else {
?>

<!-- *** start form -->
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST">
<table cellpadding="4" cellspacing="0" border="0">
<tr><td><b>Name: </b></td><td><input type="text" name="realname" size="25"></td></tr>
<tr><td><b>Email:</b></td><td><input type="text" name="email" size="25"></td></tr>
<tr><td colspan=2><b>Feedback:</b><br />
<textarea name="feedback" rows="4" cols="40" wrap="physical"></textarea>
</td></tr>
<tr><td colspan="2" align="right"><input type="submit" value="Send Feedback"></td></tr>
</table>
</form>
<!-- *** end form -->

<?php } ?>

</body>
</html>

And when i send an email containing a Bulgarian word i get
&#1092;&#1076;&#1075;&#1092; etc...

My mailbox accepts only text/plain

I've tried a lot of options, but nothing didn't worked

Help would be greatly appreciated

Edit:I have a typo in the title

ksks

2:27 pm on May 31, 2008 (gmt 0)

10+ Year Member



&#1047;&#1076;&#1088;&#1072;&#1074;&#1077;&#1081;&#1090;&#1077;...
Should be - Zdravete

Not related to your question but, you have:

if ($_SERVER['REQUEST_METHOD'] == "POST") {

twice...is this necessary?

ps
&#1054;&#1090; &#1082;&#1098;&#1076;&#1077; &#1089;&#1090;&#1077;? &#1057;&#1086;&#1092;&#1080;&#1103;?
Should be - Ot kade ste? Sofia?

Edit
I see the Bulgarian words did not come out correctly .... :(

alex95_bg

5:59 pm on Jun 3, 2008 (gmt 0)

10+ Year Member



if ($_SERVER['REQUEST_METHOD'] == "POST") {
is twice because the script is spit in two places once the form is submitted

I'm not the one that would recieve those emails so my customers need to see it clearly and understand it, not seeing escaped text :)

In gave the escaped text as an example - it's not a word but some nonsence

I was asking for a way of somehow encoding the output to utf-8