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

推荐订阅源

T
Threat Research - Cisco Blogs
C
CERT Recently Published Vulnerability Notes
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
S
Securelist
K
Kaspersky official blog
V
Vulnerabilities – Threatpost
C
Cisco Blogs
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Security Affairs
Forbes - Security
Forbes - Security
Spread Privacy
Spread Privacy
C
CXSECURITY Database RSS Feed - CXSecurity.com
P
Palo Alto Networks Blog
H
Hacker News: Front Page
L
Lohrmann on Cybersecurity
Cloudbric
Cloudbric
S
Schneier on Security
Simon Willison's Weblog
Simon Willison's Weblog
I
InfoQ
人人都是产品经理
人人都是产品经理
PCI Perspectives
PCI Perspectives
月光博客
月光博客
爱范儿
爱范儿
Jina AI
Jina AI
WordPress大学
WordPress大学
N
News and Events Feed by Topic
Cyberwarzone
Cyberwarzone
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
小众软件
小众软件
Google Online Security Blog
Google Online Security Blog
W
WeLiveSecurity
V
V2EX
阮一峰的网络日志
阮一峰的网络日志
美团技术团队
博客园 - 司徒正美
Scott Helme
Scott Helme
AI
AI
L
LangChain Blog
A
Arctic Wolf
博客园 - 【当耐特】
量子位
S
SegmentFault 最新的问题
The GitHub Blog
The GitHub Blog
MyScale Blog
MyScale Blog
腾讯CDC
博客园 - 叶小钗
Last Week in AI
Last Week in AI
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;
}