Monday, November 08, 2010 at 12:07 AM.
system.verbs.builtins.xml.rss.decodeString
on decodeString (s, flNeuterMacros=true) {
<<Changes
<<5/27/08; 5:11:12 PM by DW
<<More comprehensive character corrections using string.multipleReplaceAll.
<<5/26/08; 7:51:31 PM by DW
<<Change a curly-quote to a single-quote.
<<11/30/02; 5:33:41 PM by JES
<<New optional parameter, flNeuterMacros. Defaults to true, preserving existing behavior.
<<10/2/02; 9:04:47 PM by JES
<<Don't decode entities that were already decoded by xml.compile when the channel was loaded. Fixes the double-decoding bug where sample HTML text was being displayed in the news page as actual HTML.
<<3/15/02; 5:54:43 PM by DW
<<Created. Factored out of xml.rss.compileService, so drivers can get at it.
bundle { //pass through string.multipleReplaceAll
local (t);
new (tabletype, @t);
t.["“"] = "\"";
t.["”"] = "\"";
t.["Õ"] = "'";
t.["“"] = "\"";
t.["”"] = "\"";
t.["—"] = "--";
t.["'"] = "'";
t.["""] = "\"";
s = string.multiplereplaceall (s, @t, false)};
<<s = string.replaceAll (s, "'", "'")
<<s = string.replace (s, "Õ", "'") //5/26/08; 7:51:20 PM by DW
<<s = string.replaceAll (s, """, "\"")
s = xml.entityDecode (s, false, true); //false means we don't want to decide &, > and < -- they've already been decoded by xml.compile.
if flNeuterMacros {
s = string.replaceall (s, "{", "{");
s = string.replaceall (s, "}", "}");
s = string.replaceall (s, "<%", "<%")};
if system.environment.isMac { //02/22/2001 JES: convert to Mac text on Macintoshes
s = latinToMac.convert (s)};
return (s)};
bundle { //test code
dialog.alert (decodeString ("jessieÕs cute skirt"))}
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.