有。
asp中
<%
    Response.Write "&#" & ASC("你") & ";"
%>运行一把,你就知道了。

解决方案 »

  1.   

    不好意思,搂住提的是php阿。
    php 4.3.1后可以用iconv函数
      

  2.   

    iconv
    (PHP 4 >= 4.0.5)iconv -- Convert string to requested character encoding
    Description
    string iconv ( string in_charset, string out_charset, string str)
    Performs a character set conversion on the string str from in_charset to out_charset. Returns the converted string or FALSE on failure. 例子 1. iconv() example:<?php
    echo iconv("ISO-8859-1", "UTF-8", "This is a test.");
    ?>  
     
      

  3.   

    也可以用utf8_encode
    (PHP 3>= 3.0.6, PHP 4 )
    utf8_encode -- 将 ISO-8859-1 编码的字符串转换为 UTF-8 编码
    描述
    string utf8_encode ( string data)
      

  4.   

    iconv很多主机都没装这个函数的库而且听说问题多多。实际上我是需要把中文或者别的字符集换成一种统一的字符集然后用xml文件输出
    由于xmldom比较娇嫩,一出现不同字符集的文字就PARSE出错。
    所以我想在进数据库之前,把所有字符转换一下。
    当然要在服务器端完成,如果在client中完成的话不安全。utf8_encode编码后,浏览器不能正常显示。
      

  5.   

    gb2312 和 unicode 间的编码转换下面的例子是将 gb2312 转换为 "&#20840;"这种形式php4.3.1以后的iconv函数很好用的,只是需要自己写一个uft8到unicode的转换函数
    查表(gb2312.txt)也行
    <?
    $text = "电子书库";
    preg_match_all("/[\x80-\xff]?./",$text,$ar);
    foreach($ar[0] as $v)
      echo "&#".utf8_unicode(iconv("GB2312","UTF-8",$v)).";";
    ?>
    <?
    // utf8 -> unicode
    function utf8_unicode($c) {
      switch(strlen($c)) {
        case 1:
          return ord($c);
        case 2:
          $n = (ord($c[0]) & 0x3f) << 6;
          $n += ord($c[1]) & 0x3f;
          return $n;
        case 3:
          $n = (ord($c[0]) & 0x1f) << 12;
          $n += (ord($c[1]) & 0x3f) << 6;
          $n += ord($c[2]) & 0x3f;
          return $n;
        case 4:
          $n = (ord($c[0]) & 0x0f) << 18;
          $n += (ord($c[1]) & 0x3f) << 12;
          $n += (ord($c[2]) & 0x3f) << 6;
          $n += ord($c[3]) & 0x3f;
          return $n;
      }
    }
    ?>
    下面的例子是利用php将"&#20840;"这中编码转换为gb2312.
    <?php
    $str = "TTL&#20840;&#22825;&#20505;&#33258;&#21160;&#32858;&#28966;";
    $str = preg_replace("|&#([0-9]{1,5});|", "\".u2utf82gb(\\1).\"", $str);
    $str = "\$str=\"$str\";";eval($str);
    echo $str;function u2utf82gb($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 iconv('UTF-8', 'GB2312', $str);
    }
    ?>或者是function unescape($str) {
      $str = rawurldecode($str);
      preg_match_all("/(?:%u.{4})|&#x.{4};|&#\d+;|.+/U",$str,$r);
      $ar = $r[0];
    print_r($ar);
      foreach($ar as $k=>$v) {
        if(substr($v,0,2) == "%u")
          $ar[$k] = iconv("UCS-2","GB2312",pack("H4",substr($v,-4)));
        elseif(substr($v,0,3) == "&#x")
          $ar[$k] = iconv("UCS-2","GB2312",pack("H4",substr($v,3,-1)));
        elseif(substr($v,0,2) == "&#") {
    echo substr($v,2,-1)."<br>";
          $ar[$k] = iconv("UCS-2","GB2312",pack("n",substr($v,2,-1)));
        }
      }
      return join("",$ar);
    }$str = "TTL&#20840;&#22825;&#20505;&#33258;&#21160;&#32858;&#28966;";
    echo unescape($str); //out TTL全天候自动聚焦