字符编码- SMS文本消息从send-mail.php到4G %符号更改为颠倒问号


character encoding - SMS text message from send-mail.php to 4G percent sign changes to upside down question mark

当我从send-mail.php向4G手机发送SMS文本消息时,百分号变成了一个颠倒的问号。它可以很好地发送到3G手机。该信息是关于降雨的概率,例如"10%的降雨机会"。

<?php 
   // Phone number to send to 
   $phone2send2 = '1231234567@vtext.com'; 
   $headers = "From:" . $from; 
   $strForecast = "10% chance of rain"; 
   $body = $strForecast; 
   if (mail($phone2send2, $subject, $strForecast, $headers, "-f me@me.com")) { } else { }        
?>

我怀疑您的手机正在尝试将字符串解析为UTF-8。在某个地方,编码变得混乱了。尝试使用utf8_encode()方法:

$strForecast = utf8_encode("10% chance of rain");