从unicode编码中构造一张,很简单的

解决方案 »

  1.   

    to:xuzuning(唠叨)首先谢谢你回答我的问题!但是像wizz说的 哪里有unicode码表呢?对编码方面的东西了解的不多 感觉无从下手thanks any way!!
      

  2.   

    在网上很容易找到936代码页的资料,当然你可以自己做一张。
    利用ie将gb编码转换为unicode编码
    <?php
    header("Content-Type: text/html; charset=gb2312");
    echo "<title>936 代码页</title>";
    $i = $_GET['i'];
    if($i<129)
      $i = 129;
    if($i>254)
      $i = 254;
    if($i != 129) {
      echo "<a href='?i=129'>首页</a>\n";
      echo "<a href='?i=".($i-1)."'>上页</a>\n";
    }
    if($i != 254) {
      echo "<a href='?i=".($i+1)."'>下页</a>\n";
      echo "<a href='?i=254'>尾页</a>\n";
    }
    echo "<table border CELLPADDING='1' CELLSPACING='0'>";
    printf("<tr><th>%2X</th>",$i);
    for($j=0;$j<16;$j++)
      printf("<th>%X</th>",$j);
    echo "</tr>";
    for($j=64;$j<255;$j++) {
      if($j%16 == 0) {
        if($j>64)
          echo "</tr>";
        printf("<tr><th>%X</th>",$j/16);
      }
      if($j==127)
        echo "<td></td>";
      else {
        $v = pack("S",$j*256+$i);
        $v = chr($i).chr($j);
        echo "<td>$v</td>";
      }
    }
    echo "<td></td></tr></table>";
    ?>
    <script>
    obj = document.all.tags("TD");
    for(i=0;i<obj.length;i++)
      if(obj[i].innerHTML != "")
        obj[i].innerHTML += "<br>"+obj[i].innerHTML.charCodeAt().toString(16).toUpperCase();
    </script>------/**
     * 转换unicode十进制内码为utf-8编码
     */
    function u2utf8($c) { 
     $str=""; 
     if ($c < 0x80) { 
      $str.=$c; 
     } else if ($c < 0x800) { 
      $str.=chr(0xC0 | $c>>6); 
      $str.=chr(0x80 | $c & 0x3F); 
     } else if ($c < 0x10000) { 
      $str.=chr(0xE0 | $c>>12); 
      $str.=chr(0x80 | $c>>6 & 0x3F); 
      $str.=chr(0x80 | $c & 0x3F); 
     } else if ($c < 0x200000) { 
      $str.=chr(0xF0 | $c>>18); 
      $str.=chr(0x80 | $c>>12 & 0x3F); 
      $str.=chr(0x80 | $c>>6 & 0x3F); 
      $str.=chr(0x80 | $c & 0x3F); 
     }
     return $str; 
    }