HTML entity escaping?

Matthias Rebbe matthias_livecode_150811 at m-r-d.de
Thu Jan 10 07:50:35 EST 2019


Hi,

is there a reason for all the * in the script?

Makes it difficult  to read and uneeded work to get it correct in the SE.

Matthias Rebbe

free tools for Livecoders:
https://instamaker.dermattes.de
https://winsignhelper.dermattes.de

> Am 10.01.2019 um 00:56 schrieb David Bovill via use-livecode <use-livecode at lists.runrev.com>:
> 
> Hi Devin, yes that would work for an app - but this is for Livecode server
> - I'm not sure but is there a way to do that with revIgniter - ie create a
> field by script and use the functionality that way - this is the old hack
> I'm using / found - if anyone finds it useful / can improve on it ( i
> should probably use arrays):
> 
> *command* text_HtmlEntityEscape @someText, pNotQuotes
>> *local* sNum, eNum
>> *put* 0 into countNum
>> *put* "(&[^;]+;)" into someReg
>> *put* html_EntityList (pNotQuotes) into htmlEntities
>> *put* html_EntityCharNums (pNotQuotes) into entityCharNums
>> *set* the wholematches to true
>> 
>> *repeat**get* matchchunk (someText, someReg, sNum, eNum)
>> *if* sNum is not a number *then* *return* empty
>> *-- breakpoint -- bug**if* it is false *then* *return* countNum
>> *put* char sNum to eNum of someText into foundEntity
>> *if* char 1 to 2 of foundEntity = "&#"
>> *then**put* char 3 to -2 of foundEntity into cNum
>> *if* cNum is not a number
>> *then*
>> *-- breakpoint -- bug**return* empty
>> *end*
>> *if*
>> *else**put* itemOffset (foundEntity, htmlEntities) into itemNum
>> *if* itemNum is 0
>> *then*
>> *-- next repeat -- infinite loop**end*
>> *if**put* item itemNum of entityCharNums into cNum
>> *end*
>> *if**put* numToChar (cNum) into eChar
>> 
>> *--**put* eChar into char sNum to eNum of someText
>> 
>> *--**add* 1 to countNum
>> *end*
>> *repeat**return* countNum
>> *end* text_HtmlEntityEscape
>> *function* html_EntityList pNotQuotes
>> 
>> */**
>> * Updated to add "e;*
>> * Special characters (whose ASCII value is greater than 127) are encoded
>> as HTML entities.*
>> * Revolution recognizes the following named entities:*
>> * */**get*
>> "Á,á,Â,â,´,Æ,æ,À,à,Å,å,Ã,ã,Ä,ä,¦,Ç,ç,¸,¢,©,¤,°,÷,É,é,Ê,ê,È,è,Ð,ð,Ë,ë,&frac12;,&frac14;,&frac34;,>,Í,í,Î,î,¡,Ì,ì,¿,Ï,ï,«,<,¯,µ,·, ,¬,Ñ,ñ,Ó,ó,Ô,ô,Ò,ò,ª,º,Ø,ø,Õ,õ,Ö,ö,¶,±,£,»,®,§,­,&sup1;,&sup2;,&sup3;,ß,Þ,þ,×,Ú,ú,Û,û,Ù,ù,¨,Ü,ü,Ý,ý,¥,&yuml"
>> 
>> *--**put* "&" & comma before it
>> *if* pNotQuotes is not true
>> *then**put* """ & comma before it
>> *end*
>> *if**return* it
>> *end* html_EntityList
>> *function* html_EntityCharNums pNotQuotes
>> *get*
>> "231,135,229,137,171,174,190,203,136,129,140,204,139,128,138,3,130,141,252,162,169,219,161,214,131,142,230,144,233,143,15,19,232,145,12,11,14,62,234,146,235,148,193,237,147,192,236,149,199,60,248,181,225,202,194,132,150,238,151,239,153,241,152,187,188,175,191,205,155,133,154,166,177,163,200,168,164,4,7,5,6,167,18,21,16,242,156,243,158,244,157,172,134,159,17,20,180,216"
>> 
>> *--**put* 38 & comma before it
>> *if* pNotQuotes is not true
>> *then**put* 34 & comma before it
>> *end*
>> *if**return* it
>> *end* html_EntityCharNums
> 
> 
> On Tue, 8 Jan 2019 at 23:47, Devin Asay via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> David, I assume you mean you want to render the named entity as the proper
>> glyph? The way to do that is with the htmlText property.
>> 
>>  set the htmlText of fld “foo” to “The book costs €30."
>> 
>> Devin
>> 
>> On Jan 8, 2019, at 6:53 AM, David Bovill via use-livecode <
>> use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>>
>> wrote:
>> 
>> Is there a way / anyone have a handler to escape named html entities in
>> Livecode?
>> 
>> 
>> Á,á,Â,â,´,Æ,æ,&Agrave...
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
>> Devin Asay
>> Director
>> Office of Digital Humanities
>> Brigham Young University
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode




More information about the use-livecode mailing list