title: Allowing special characters in form submit
body: <p>So I'm coding a contact form for a website, but I want to be able to allow the user to enter non-latin based characters (i.e. é or 車) but I can't exactly figure out where I would set that up - once the user submits the form, it passes it through an AJAX section in jQuery which then processes that to PHP (which prevents the page from refreshing) but trying to use utf8_encode() didn't work and setting the contentType for the data in .ajax() didn't help either, so now I'm not sure what to do.</p>
  
  <p>Anyone able to help me out?</p>
  
  <p><strong>HTML form</strong></p>
  
  <pre><code>  &lt;form action="" id="contactUs" method="post"&gt;
      &lt;div class="input-group"&gt;
        &lt;span class="input-group-addon"&gt;name&lt;/span&gt;
        &lt;input type="text" class="form-control" placeholder="Your Name/Company" tabindex="1" name= "name" id="name" /&gt;
      &lt;/div&gt;
      &lt;div class="input-group"&gt;
        &lt;span class="input-group-addon" style="padding-right: 18px;"&gt;mail&lt;/span&gt;
        &lt;input type="email" class="form-control" placeholder="Your/Your Company Email" tabindex="2" name="email" id="email" /&gt;
      &lt;/div&gt;
      &lt;div class="input-group"&gt;
        &lt;span class="input-group-addon" style="padding-right: 18px;"&gt;subject&lt;/span&gt;
        &lt;input type="text" class="form-control" placeholder="The subject of your message" tabindex="2" name="subject" id="subject" /&gt;
      &lt;/div&gt;
      &lt;div class="input-group"&gt;
        &lt;span class="input-group-addon" style="padding-right: 18px;"&gt;message&lt;/span&gt;
        &lt;textarea class="form-control" placeholder="What's on your mind?" cols="100" rows="4" tabindex="3" name="msg" id="msg"&gt;&lt;/textarea&gt;
      &lt;/div&gt;
      &lt;div class="input-group"&gt;
        &lt;span class="input-group-btn"&gt;
          &lt;button class="btn btn-default" type="submit" style="-webkit-border-radius: 8px; border-radius: 8px; position: relative; left: 41%;" id="submit"&gt;Submit&lt;/button&gt;
        &lt;/span&gt;
      &lt;/div&gt;
    &lt;/form&gt;
  </code></pre>
  
  <p><strong>jQuery</strong></p>
  
  <pre><code>    var dataString = 'name=' + name + '&amp;email=' + email + "&amp;subject=" + subject +  '&amp;msg=' + msg;
      $.ajax ({  
              type: "POST",  
              url: "process.php",
              data: {
                  name : name,
                  email : email,
                  subject :subject,
                  msg : msg
              },  
              contentType: "application/x-www-form-urlencoded;charset=ISO-8859-15",
              dataType: 'json',
              complete: function() {  
                  $("#error").hide();
                  $("#errormail").hide();
                  $("textarea#msg").css("background-color", "#ffffff");
                  $("input#email").css("background-color", "#ffffff");
                  $("input#name").css("background-color", "#ffffff");
                  $("#success").show();
  
                  setTimeout(
                      function(){ $('#success').fadeOut() }, 5000
                  );
                  $( '#contactUs' ).each(function(){
                      this.reset();
                  });
              }
      });
  </code></pre>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>&lt;?php
  
  if(isset($_POST['email'])) {
  
      $email_to = "info@infinitedream.net ";
      $email_from = $_POST['email']; // required
      $email_subject = $_POST['subject'];
  
      $name = $_POST['name']; // required
      $message = $_POST['msg']; // required
  
      $email_message = '&lt;html&gt;&lt;body&gt;';
  
      function clean_string($string) {
        $bad = array("content-type","bcc:","to:","cc:","href");
        return str_replace($bad,"",$string);
      }
  
      $email_message .= '&lt;table rules="all" style="border: 1px solid #666;" cellpadding="10"&gt;';
      $email_message .= "&lt;tr style='background: #eee;'&gt;&lt;td&gt;&lt;strong&gt;Name:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" . strip_tags($name) . "&lt;/td&gt;&lt;/tr&gt;";
      $email_message .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Email:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" . strip_tags($email_from) . "&lt;/td&gt;&lt;/tr&gt;";
      $email_message .= "&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Message:&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;" . utf8_encode($message) . "&lt;/td&gt;&lt;/tr&gt;";
      $email_message .= "&lt;/table&gt;";
      $email_message .= "&lt;/body&gt;&lt;/html&gt;";
  
  
  // create email headers
  $headers = 'From: '.$email_from."\r\n";
  $headers = 'Reply-To: '.$email_from."\r\n";
  $headers = 'X-Mailer: PHP/' . phpversion();
  $headers .= "MIME-Version: 1.0" . "\r\n";
  $headers = "Content-type:text/html;charset=iso-8859-1" . "\r\n";
  mail($email_to, $email_subject, $email_message, $headers);  
  
  }
  ?&gt;
  </code></pre>