惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

MyScale Blog
MyScale Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
阮一峰的网络日志
阮一峰的网络日志
罗磊的独立博客
博客园 - 叶小钗
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
美团技术团队
酷 壳 – CoolShell
酷 壳 – CoolShell
雷峰网
雷峰网
宝玉的分享
宝玉的分享
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
爱范儿
爱范儿
小众软件
小众软件
K
Kaspersky official blog
P
Proofpoint News Feed
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - Franky
V
Vulnerabilities – Threatpost
博客园_首页
Microsoft Security Blog
Microsoft Security Blog
C
Cybersecurity and Infrastructure Security Agency CISA
V
V2EX
C
Check Point Blog
S
Schneier on Security
P
Palo Alto Networks Blog
IT之家
IT之家
GbyAI
GbyAI
T
Threat Research - Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Apple Machine Learning Research
Apple Machine Learning Research
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tailwind CSS Blog
Project Zero
Project Zero
Y
Y Combinator Blog
V
Visual Studio Blog
Simon Willison's Weblog
Simon Willison's Weblog
T
Threatpost
Scott Helme
Scott Helme
L
LINUX DO - 热门话题
S
Securelist
C
CERT Recently Published Vulnerability Notes
A
Arctic Wolf
M
MIT News - Artificial intelligence
人人都是产品经理
人人都是产品经理

博客园 - 清雨轩

用dom生成html文件.的常见问题 div+css制作企业网站经验收集 appendNode? 可以直接一个节点树 - 清雨轩 - 博客园 php(alexa排名查询) 下拉菜单 美工版(不用写代码) CSS学习随笔 windows2003 ftp及相关权限 php出现Unable to load dynamic library 'c:\php\extensions\php_mssql.dll' - 清雨轩 win2003的服务器配置. 关于引用,还是按值. 开发时会遇到..注意 个人javascript作品集 事件监听是可吃CPU的事情。以后还是不用事件监听 用正则改变字符串的处理速度。 faq:responseXML has no properties in firefox or responseXML is null 正则表达式 不允许为空 下拉头像菜单 表单检测函数 [原创]使用js+xml制作的IE和FF都支持的树型菜单(程序不到4k哦) 个人觉得比较经典的菜单(来源:kijiji.cn)
[转载]纯js解决小偷的乱码.(强)
清雨轩 · 2006-09-18 · via 博客园 - 清雨轩

<script>
function encode_utf8(rawtext) {
   rawtext 
= rawtext.replace(/\r\n/g,"\n");
   
var utftext = "";
   
for(var n=0; n<rawtext.length; n++)
       
{
       
//
       var c=rawtext.charCodeAt(n);
       
// 0-127 => 1byte
       if (c<128)
           utftext 
+= String.fromCharCode(c);
       
// 127 - 2047 => 2byte
       else if((c>127&& (c<2048)) {
           utftext 
+= String.fromCharCode((c>>6)|192);
           utftext 
+= String.fromCharCode((c&63)|128);}

       
// 2048 - 66536 => 3byte
       else {
           utftext 
+= String.fromCharCode((c>>12)|224);
           utftext 
+= String.fromCharCode(((c>>6)&63)|128);
           utftext 
+= String.fromCharCode((c&63)|128);}

       }

   
return utftext;
}

function decode_utf8(utftext) {
   
var plaintext = ""var i=0var c=c1=c2=0;
   
while(i<utftext.length)
       
{
       c 
= utftext.charCodeAt(i);
       
if (c<128{
           plaintext 
+= String.fromCharCode(c);
           i
++;}

       
else if((c>191&& (c<224)) {
           c2 
= utftext.charCodeAt(i+1);
           plaintext 
+= String.fromCharCode(((c&31)<<6| (c2&63));
           i
+=2;}

       
else {
           c2 
= utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2);
           plaintext 
+= String.fromCharCode(((c&15)<<12| ((c2&63)<<6| (c3&63));
           i
+=3;}

       }

   
return plaintext;
}

</script>

posted on 2006-09-18 08:36  清雨轩  阅读(608)  评论(0)    收藏  举报

刷新页面返回顶部