Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Problem with special characters and cyrillic characters

  • This topic is empty.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #36129

    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

    #94637
    Billy
    Participant

    Is 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.

    #94639

    It’s UTF-8. I’ll try searching for some code.
    Cheers.

    #94641
    Billy
    Participant

    UTF-8 usually works for me; I get é è à ÿ ü ö ï î ô û â á ø ß, and loads more.

    #94643
    Billy
    Participant

    otherwise use the ASCII values. For example
    é = &eacute; = &#233;

    #94646

    but will that work for the cyrillic characters?

    #94653
    Mottie
    Member

    I’m pretty sure that the ASCII values should work no matter the page setting.

    #94655

    Since 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?

    #94657
    Billy
    Participant

    I 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)

    #94660
    Mottie
    Member

    cyneWATCH provided a link to the ASCII table, basically just type in the characters inline like this: &#192; 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): &#x00c0; = À

    Edit: The Cyrillic alphabet is included in UTF-8 format:

    &#1049; or &#x0419; = Й
    &#1078; or &#x0436; = ж

    #94664

    Thanks 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.

    #94666
    Billy
    Participant

    What 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?)

    #94667

    It’s in Estonian.

    #94670
    Billy
    Participant

    So you need it then.Have you tried looking up how to use Estonian characters in PHP and HTML?

    #94672
    Mottie
    Member

    Are 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: &#196; or &#x00c4; = Ä

Viewing 15 posts - 1 through 15 (of 15 total)
  • The forum ‘Back End’ is closed to new topics and replies.