PHP 代码:
function gb23122uni($text) {
$rtext="";
$max=strlen($text);
for($i=0;$i<$max;$i++){
$h=ord($text[$i]);
if($h>=160 && $i<$max-1){
$rtext.="&#".base_convert(bin2hex(iconv("gb2312","ucs-2",substr($text,$i,2))),16,10).";";
$i++;
}else{
$rtext.=$text[$i];
}
}
return $rtext;
}
但很多服务器不支持ICONV(),学了两天的JS,我总算解决了 !
function gbUni(theText)
{
if (theText) {
var intoInfo="";
var n=theText.length;
for (i=0;i<n;i++) {
intoInfo +="&#"+theText.charCodeAt(i)+";";
}
document.threadForm.messageNi.value =intoInfo;
document.threadForm.submit();
} else {
false;
}
}
function gb23122uni($text) {
$rtext="";
$max=strlen($text);
for($i=0;$i<$max;$i++){
$h=ord($text[$i]);
if($h>=160 && $i<$max-1){
$rtext.="&#".base_convert(bin2hex(iconv("gb2312","ucs-2",substr($text,$i,2))),16,10).";";
$i++;
}else{
$rtext.=$text[$i];
}
}
return $rtext;
}
但很多服务器不支持ICONV(),学了两天的JS,我总算解决了 !
function gbUni(theText)
{
if (theText) {
var intoInfo="";
var n=theText.length;
for (i=0;i<n;i++) {
intoInfo +="&#"+theText.charCodeAt(i)+";";
}
document.threadForm.messageNi.value =intoInfo;
document.threadForm.submit();
} else {
false;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货