找了一個中文轉化UNICODE底的函數

發表于:2007-07-14來源:作者:點擊數: 標簽:
? php // GB2312 轉換為 unicode 的函數 // Program by sadly (www.phpx.com) function gb2unicode($gb) { if(!trim($gb)) return $gb; $filename=gb2312.txt; $tmp=file($filename); $codetable=array(); while(list($key,$value)=each($tmp)) $codetable[h
<?php
// GB2312 轉換為 unicode 的函數  
// Program by sadly (www.phpx.com)

function gb2unicode($gb)
{
  if(!trim($gb))
   return $gb;
  $filename="gb2312.txt";
  $tmp=file($filename);
  $codetable=array();
  while(list($key,$value)=each($tmp))
   $codetable[hexdec(substr($value,0,6))]=substr($value,9,4);
  $utf="";
  while($gb)
  {
   if (ord(substr($gb,0,1))>127)
    {
    $this=substr($gb,0,2);
    $gb=substr($gb,2,strlen($gb));
    $utf.="&#x".$codetable[hexdec(bin2hex($this))-0x8080].";";
    }
   else
    {
    $gb=substr($gb,1,strlen($gb));
    $utf.=substr($gb,0,1);
    }
   }
  return $utf;
}
?>

但是我沒有gb2312碼表,哪位能提供一份???

原文轉自:http://www.anti-gravitydesign.com

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97