Chinaunix首页 | 论坛 | 博客
  • 博客访问: 116547
  • 博文数量: 49
  • 博客积分: 91
  • 博客等级: 民兵
  • 技术积分: 269
  • 用 户 组: 普通用户
  • 注册时间: 2012-05-02 10:14
文章分类

全部博文(49)

文章存档

2012年(49)

我的朋友

分类:

2012-05-02 10:15:27

原文地址:UNICODE与汉字互转 作者:ztguang

filename:  test.html
----------------------------



UNICODE与汉字互转











//单击【Unicode加密】结果:00610062006300648fbe5230


++++++++++++++++++++++++++++++++++++++++++++++++++++

filename:  test.php
----------------------------

function utf82unicode($str) 
{
    return iconv("utf-8", "UCS-2BE", $str);
}
 
function hex2str($hexstring) 
{
    $str = '';
    for($i = 0, $len = strlen($hexstring); $i < $len; $i++)
    {
        $str .= sprintf("%02X", ord(substr($hexstring, $i, 1)));
    }
    return $str;
}

echo utf82unicode("abcd达到");
echo '---';
echo hex2str(utf82unicode("abcd达到"));

// 结果:abcd??R0---00610062006300648FBE5230
阅读(262) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:GRUB引导ISO安装Ubuntu

给主人留下些什么吧!~~