- This topic is empty.
-
AuthorPosts
-
January 15, 2012 at 2:22 pm #36129lauritonissonMember
Hey.
I have a problem with a site I’m working on. I’ve added a contact form to the site but when I fill out a part of the form with cyrillic characters or special characters like (õ, ä , ü , ö, etc.), the mail that contactengine.php generates doesn’t show these characters. Instead it generates random gibberish symbols in the mail. For some reason this is not a problem with Gmail but with the other email service provider I need to send these contact emails.
Here’s my contactengine.php
$EmailFrom = "Rentgard";
$EmailTo = "[email protected], [email protected], [email protected]";
$Subject = "Rentgard broneering";
$datepickerID = Trim(stripslashes($_POST));
$datepickerID2 = Trim(stripslashes($_POST));
$Company = Trim(stripslashes($_POST));
$Register = Trim(stripslashes($_POST));
$Toode = Trim(stripslashes($_POST));
$Teenus = Trim(stripslashes($_POST));
$Nimi = Trim(stripslashes($_POST));
$ID = Trim(stripslashes($_POST));
$Telefon = Trim(stripslashes($_POST));
$Email = Trim(stripslashes($_POST));
// validation
$validationOK=true;
if (!$validationOK) {
print "";
exit;
}
// prepare email body text
$Body = "";
$Body .= "datepickerID: ";
$Body .= $datepickerID;
$Body .= "n";
$Body .= "datepickerID2: ";
$Body .= $datepickerID2;
$Body .= "n";
$Body .= "Firma_nimi:";
$Body .= $Company;
$Body .= "n";
$Body .= "Äri_registri_nr:";
$Body .= $Register;
$Body .= "n";
$Body .= "Toode: ";
$Body .= $Toode;
$Body .= "n";
$Body .= "Teenus: ";
$Body .= $Teenus;
$Body .= "n";
$Body .= "Nimi: ";
$Body .= $Nimi;
$Body .= "n";
$Body .= "Isikukood: ";
$Body .= $ID;
$Body .= "n";
$Body .= "Telefon: ";
$Body .= $Telefon;
$Body .= "n";
$Body .= "Email: ";
$Body .= $Email;
$Body .= "n";
// send email
$success = mail($EmailTo, $Subject, $Body, "From: <$EmailFrom>");
// redirect to success page
// CHANGE THE URL BELOW TO YOUR "THANK YOU" PAGE
if ($success){
print "";
}
else{
print "";
}
?>Here is my html
If anyone could help me I would really appreciate it !
Lauri
January 15, 2012 at 2:28 pm #94637BillyParticipantIs it UTF-8, or UTF-16 or something? If it isn’t, try that.
Otherwise, try finding some PHP code that sets a certain range of ASCII characters.January 15, 2012 at 2:33 pm #94639lauritonissonMemberIt’s UTF-8. I’ll try searching for some code.
Cheers.January 15, 2012 at 2:36 pm #94641BillyParticipantUTF-8 usually works for me; I get é è à ÿ ü ö ï î ô û â á ø ß, and loads more.
January 15, 2012 at 2:37 pm #94643BillyParticipantotherwise use the ASCII values. For example
é = é = éJanuary 15, 2012 at 2:53 pm #94646lauritonissonMemberbut will that work for the cyrillic characters?
January 15, 2012 at 3:12 pm #94653MottieMemberI’m pretty sure that the ASCII values should work no matter the page setting.
January 15, 2012 at 3:22 pm #94655lauritonissonMemberSince I’m fairly new to all this, where exactly do I enter these values? Html head? And what kind of syntax is neccessary to add a characters numerical or hex code?
January 15, 2012 at 3:59 pm #94657BillyParticipantI don’t think there’s any Cyrillic actually. Sorry. You’d have to change it from UTF-8 to whatever one has Cyrillic in.
To use the special characters; swap each one in the code for the special value.
This:
$Body .= “Äri_registri_nr:”;
to this:
$Body .= “Äri_registri_nr:”;(I’ve had it not work with js, but I’m not sure about PHP)
January 15, 2012 at 4:02 pm #94660MottieMembercyneWATCH provided a link to the ASCII table, basically just type in the characters inline like this: À and you should get this: À
You can use hex code as well, but it follows this format (the “x” is needed with a 4 digit value): À = À
Edit: The Cyrillic alphabet is included in UTF-8 format:
Й or Й = Й
ж or ж = жJanuary 15, 2012 at 4:13 pm #94664lauritonissonMemberThanks guys, unfortunally it didn’t do the trick, the Ä from the contactengine still gets replaced by gibberish and the user input text which may contain special characters or cyrillic doesn’t work either.
January 15, 2012 at 4:16 pm #94666BillyParticipantWhat language does is the Ä from? There is a way I think to make these possible in PHP (telling the code to not accept HTML values, but this time telling it to change certain things?)
January 15, 2012 at 4:19 pm #94667lauritonissonMemberIt’s in Estonian.
January 15, 2012 at 4:22 pm #94670BillyParticipantSo you need it then.Have you tried looking up how to use Estonian characters in PHP and HTML?
January 15, 2012 at 4:30 pm #94672MottieMemberAre you using the javascript escape function to convert the inputted text?
Also, I just set up this page with a list of HTML escape codes, look around 1024 for Russian Cyrillic codes. I didn’t see it specifically listing Estonian, but isn’t it the same alphabet? (sorry I’m a bit clueless).
Edit: Ä or Ä = Ä
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.