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

推荐订阅源

Google Online Security Blog
Google Online Security Blog
P
Proofpoint News Feed
Martin Fowler
Martin Fowler
D
DataBreaches.Net
V
Visual Studio Blog
M
MIT News - Artificial intelligence
C
Check Point Blog
The GitHub Blog
The GitHub Blog
云风的 BLOG
云风的 BLOG
F
Full Disclosure
MongoDB | Blog
MongoDB | Blog
GbyAI
GbyAI
H
Hackread – Cybersecurity News, Data Breaches, AI and More
I
InfoQ
aimingoo的专栏
aimingoo的专栏
L
LangChain Blog
Recorded Future
Recorded Future
B
Blog RSS Feed
Y
Y Combinator Blog
Stack Overflow Blog
Stack Overflow Blog
博客园 - 司徒正美
Forbes - Security
Forbes - Security
美团技术团队
Google DeepMind News
Google DeepMind News
H
Help Net Security
L
LINUX DO - 最新话题
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
W
WeLiveSecurity
MyScale Blog
MyScale Blog
O
OpenAI News
P
Privacy & Cybersecurity Law Blog
Attack and Defense Labs
Attack and Defense Labs
N
Netflix TechBlog - Medium
T
Troy Hunt's Blog
月光博客
月光博客
Recent Commits to openclaw:main
Recent Commits to openclaw:main
B
Blog
V
V2EX
WordPress大学
WordPress大学
H
Heimdal Security Blog
U
Unit 42
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Simon Willison's Weblog
Simon Willison's Weblog
S
SegmentFault 最新的问题
SecWiki News
SecWiki News
D
Docker
Blog — PlanetScale
Blog — PlanetScale
S
Secure Thoughts

博客园 - fengzhimei

The template you have chosen is invalid or cannot be found. CSS trick : text-transform Site Definition KickStart Project Transform between Hex and Dec in Javascript - fengzhimei Visual Studio 2005 Web Application Projects Template Overcome limitation of activate ActiveX control in IE "Suggested Web Parts" in SharePoint 2007 Web Part picker page. - fengzhimei Extend toolbar of HtmlEditor in SharePoint 2007 Expand querystring in URL with JavaScript Create a AJAX enabled WebPart for SharePoint2007 by using ASP.NET 2.0 client callback feature Code view is missing in SharePoint Designer Beta 2 when you try to edit a WSS v3 site. MOSS2007(Beta) SDK is online. .Net Framework v2.0 built-in tools StringBuilder in Javascript Remove duplicate rows from a table Remove duplicate items from collection Programatically download file from document library. Reset VSS Admin Password A nice piece of javascript to simulate Adodb Recordset.
Html entity encoder/decoder
fengzhimei · 2005-11-25 · via 博客园 - fengzhimei

Detail refer to

http://andrewu.co.uk/clj/entityencode/.

function TextToEntities(strPlainText, blnPartialEncodeOnly) {
    
var strPartial  = [];
    
var strFull     = [];
    
var intP        = 0;
    
var intF        = 0;
    
var objPartialRegExp = (new RegExp).compile("[\\w\\s]");

    
for (var intI=0; intI<strPlainText.length; ++intI) {
        
var strChar = strPlainText.charAt(intI);
        
var intChar = strChar.charCodeAt(0);

        
if (isNaN(intChar)) {
            
// IF CHAR FAILED TO DECODE, LEAVE AS CHAR
            strPartial.push(strFull.push(strChar));
        }

        
else {
            
var strEntity = "&#" + intChar + ";";
            strFull.push(strEntity);
            
// IF CHAR WAS [a-zA-Z0-9_ \t] LEAVE AS CHAR, ELSE REPLACE WITH ENTITY
            strPartial.push(objPartialRegExp.test(strChar) ? strChar : strEntity);
        }

    }

    
return (blnPartialEncodeOnly ? strPartial.join("") : strFull.join(""));
}


function EntitiesToText(strEncodedText) {
    
var strData     = String(strEncodedText);
    
var objRegExp   = (new RegExp).compile("&#(\\d+);""ig");

    
/* FOR EACH MATCH TO ANY ENTITY, REPLACE THAT
    ENTITY GLOBALLY WITH ITS SINGLE CHAR EQUIVALENT 
*/

    
while(strData.match(objRegExp)) {
        
var strCharMatch    = RegExp.$1;
        
var objRegExpMatch  = new RegExp("&#" + strCharMatch + ";""ig");
        strData 
= strData.replace(objRegExpMatch, String.fromCharCode(strCharMatch));
    }

    
return strData;
}