开发者

Problem encoding with utf-8

开发者 https://www.devze.com 2023-03-22 03:22 出处:网络
I referred to serhio for the utf-8 encoding problem and hv been trying for the whole day different methods searched from net :( I want to show the chinese characters in subject lines but when received

I referred to serhio for the utf-8 encoding problem and hv been trying for the whole day different methods searched from net :( I want to show the chinese characters in subject lines but when received in gmail it shows rubbish characters. I had tried to put

header('Content-Type: text/html; charset=utf-8'); 

on top of page but not working

i tried to add "\r\n" also not working

My code as below

$mail->开发者_运维知识库charset = 'utf-8';
$mail->body('',$strInv);
$mail->subject('"=?UTF-8?B?".base64_encode(我的问题)."?=" #'.$inquiry_no);

when I received in gmail subject looks like this : "=?UTF-8?B?".base64_encode(è®¢å •ç¡®è®¤)."?=" #00016

I really appreciate anyone can help me with this. Thank you.


when you fix it your subject string should look like this:

=?UTF-8?B?RUSSIANNNN?=

use the echo function to debug your subject string before you call $mail->subject

or just do

$ssubject = '=?UTF-8?B?' . base64_encode('RUSSIAN') . '?=';
$ssubject = $ssubject . $inquiry_no;
$mail->subject($ssubject);

good luck newbie

0

精彩评论

暂无评论...
验证码 换一张
取 消