$.ajax({
url: “/xxx/search.php”,
type: “POST”,
contentType: “application/x-www-form-urlencoded; charset=UTF-8”,
data: “term=chống phá cách mạng, tuyên truyền phản động, xuyên tạc chủ nghĩa Mác – như thế là sai&_r=25251325”,
success: function(data) {
//console.log(data);
alert(data);
}
});
Tag Archives: utf8
Gửi mail tiếng Việt utf8
Cái này nhớ mang máng là post lâu rồi mà tìm không thấy, take note lại vậy.
<?php
if (isset($_SERVER['REMOTE_ADDR'])) exit(0);
if ($argc != 3) {
print 'Usage: ' . $argv[0] . ' <mail nguoi nhan> <noi dung>' . "\nExample: " . $argv[0] . ' "huyphungvan@gmail.com" "Phùng Văn Huy is now online"';
exit(1);
}
$to = $argv[1];
$msg = $argv[2];
$sentSuccess = sendEmail($to, $msg);
if ($sentSuccess) echo "Sent email to $to";
else echo "Sent email to $to failed";
function sendEmail($to, $message = '', $subject = 'Thư gửi Huy', $header = '') {
# Thêm header này để thư gửi thuần Việt :-j
$utf8Header = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/html; charset=UTF-8' . "\r\n";
return mail($to, '=?UTF-8?B?' . base64_encode($subject) . '?=', $message, $utf8Header . $header);
}