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@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 &quote;*
>> * Special characters (whose ASCII value is greater than 127) are encoded
>> as HTML entities.*
>> * Revolution recognizes the following named entities:*
>> * */**get*
>> "&Aacute;,&aacute;,&Acirc;,&acirc;,&acute;,&AElig;,&aelig;,&Agrave;,&agrave;,&Aring;,&aring;,&Atilde;,&atilde;,&Auml;,&auml;,&brvbar;,&Ccedil;,&ccedil;,&cedil;,&cent;,&copy;,&curren;,&deg;,&divide;,&Eacute;,&eacute;,&Ecirc;,&ecirc;,&Egrave;,&egrave;,&ETH;,&eth;,&Euml;,&euml;,&frac12;,&frac14;,&frac34;,&gt;,&Iacute;,&iacute;,&Icirc;,&icirc;,&iexcl;,&Igrave;,&igrave;,&iquest;,&Iuml;,&iuml;,&laquo;,&lt;,&macr;,&micro;,&middot;,&nbsp;,&not;,&Ntilde;,&ntilde;,&Oacute;,&oacute;,&Ocirc;,&ocirc;,&Ograve;,&ograve;,&ordf;,&ordm;,&Oslash;,&oslash;,&Otilde;,&otilde;,&Ouml;,&ouml;,&para;,&plusmn;,&pound;,&raquo;,&reg;,&sect;,&shy;,&sup1;,&sup2;,&sup3;,&szlig;,&THORN;,&thorn;,&times;,&Uacute;,&uacute;,&Ucirc;,&ucirc;,&Ugrave;,&ugrave;,&uml;,&Uuml;,&uuml;,&Yacute;,&yacute;,&yen;,&yuml"
>> 
>> *--**put* "&amp;" & comma before it
>> *if* pNotQuotes is not true
>> *then**put* "&quot;" & 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@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 &euro;30."
>> 
>> Devin
>> 
>> On Jan 8, 2019, at 6:53 AM, David Bovill via use-livecode <
>> use-livecode@lists.runrev.com<mailto:use-livecode@lists.runrev.com>>
>> wrote:
>> 
>> Is there a way / anyone have a handler to escape named html entities in
>> Livecode?
>> 
>> 
>> &Aacute;,&aacute;,&Acirc;,&acirc;,&acute;,&AElig;,&aelig;,&Agrave...
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode@lists.runrev.com<mailto:use-livecode@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to