Nie mogę zmusić poniższego skryptu do wyświetlania treści wiadomości z poprawnymi polskimi znakami utf-8
Wydaje mi się, że chodzi o złe kodowanie AJAXU.
Proszę o pomoc i z góry sedecznie dziękuje.
Plik contact.js
(function($){ $(document).ready(function() { /* ---------------------------------------------- /* * Contact form ajax /* ---------------------------------------------- */ $('#contact-form').find('input,textarea').jqBootstrapValidation({ preventSubmit: true, submitError: function($form, event, errors) { // additional error messages or events }, submitSuccess: function($form, event) { event.preventDefault(); // encoding:"UTF-8", // dataType:"html", // contentType: "text/plain; charset=UTF-8", // dataType:"html", contentType: "text/plain; charset=UTF-8" } ) var submit = $('#contact-form submit'); var ajaxResponse = $('#contact-response'); var name = $("input#cname").val(); var email = $("input#cemail").val(); var message = $("textarea#cmessage").val(); $.ajax({ type: 'POST', url: 'assets/php/contact.php', // contentType: "application/json; charset=utf-8", dataType: 'json', data: { name: name, email: email, message: message, }, cache: false, beforeSend: function(result) { submit.append('<i class="fa fa-cog fa-spin"></i> Wait...'); }, success: function(result) { if(result.sendstatus == 1) { ajaxResponse.html(result.message); $form.fadeOut(500); } else { ajaxResponse.html(result.message); } } }); } }); }); })(jQuery);
Plik contact.php
<?php $naglowki ="From: name <email>\r\n". "MIME-Version: 1.0" . "\r\n" . "Content-type: text/html; charset=UTF-8" . "\r\n"; $to = "adres@firma.pl"; $content = "Nazywam sie: " . $_POST["name"] . "\r\n"; $content .= "Moj adres email: " . $_POST["email"] . "\r\n"; $content .= "Wiadomosc: " . "\r\n" . $_POST["message"]; "message" => "Listy wysłany.", "sendstatus" => 1 ); } else { "message" => "Niestety, coś jest nie tak.", "sendstatus" => 0 ); } } ?>