我试过php编码,uriencode但它显示了??????在手机短信中显示手机短信_印度语 - हिंदी,中文 - 痴呢色,俄语 - руссиан';
$encoded_text = utf8_encode($sms_text);
$message = urlencode($encoded_text);
$infor='महोदय आपका सिंहस्थ २०१६ के लिए भूमि आवंटन का आवेदन स्वीकार करते हुए सिंहस्थ xxxx के लिए भूमि आवंटित का दी गई है';
$encoded_text = $sms_msg = mb_convert_encoding($infor, "UTF-8", "auto");
$infor=urlencode($encoded_text);
$data = array(
"username" => "xxxxST",
"password" => "xxxjx",
"senderid" =>"SxAST",
"smsservicetype" =>"singlemsg",
"mobileno" =>"94xxxxx5098",
"content" => $matter." "."Simhasth 2016- Ujjain: Land allotment form have been accepted and required land alloted to you. Contact Simhasth mela karayalya-Ujjain"
答案 0 :(得分:1)
我为此写了一篇博客,我相信它会帮助别人,因为我已经来不及回答这个问题。
$str="98XXXXXXXX 100 रु का रीचार्ज किया गया है|"; // Our SMS
$msg=str_replace('%u', '',$smsClass->utf8_to_unicode($str));//it will convert the normal message to the unicode
public function utf8_to_unicode($str) {
$unicode = array();
$values = array();
$lookingFor = 1;
for ($i = 0; $i < strlen($str); $i++) {
$thisValue = ord($str[$i]);
if ($thisValue < 128) {
$number = dechex($thisValue);
$unicode[] = (strlen($number) == 1) ? '%u000' . $number : "%u00" . $number;
} else {
if (count($values) == 0)
$lookingFor = ( $thisValue < 224 ) ? 2 : 3;
$values[] = $thisValue;
if (count($values) == $lookingFor) {
$number = ( $lookingFor == 3 ) ?
( ( $values[0] % 16 ) * 4096 ) + ( ( $values[1] % 64 ) * 64 ) + ( $values[2] % 64 ) :
( ( $values[0] % 32 ) * 64 ) + ( $values[1] % 64
);
$number = dechex($number);
$unicode[] =
(strlen($number) == 3) ? "%u0" . $number : "%u" . $number;
$values = array();
$lookingFor = 1;
} // if
} // if
}
return implode("", $unicode);
}