HTML entities

Sarah Reichelt sarah.reichelt at gmail.com
Mon May 29 22:06:48 EDT 2006


> > I have a field of data that I want to format into a web page. The data
> > can contain symbols, most likely just the degree symbol but possibly
> > others. If I get the htmltext of the field, it gives me the correct
> > entity for the degree symbol: °
> >
> > However I don't want to use the htmltext, since I am building my own
> > table display from the data. Is there a way to translate a symbol to
> > it's html entity? I suppose I could just use a lookup table of the
> > likely candidates and loop through them, replacing as necessary, but
> > since Rev "knows" the entities, I was hoping there was a function that
> > I haven't spotted, to get them directly.
> >
> You could cut/paste the list from the rev docs :-)
>
>
> I'm not suggesting this directly, but you could do something based on ...
>
> repeat with i = 1 to the number of chars in fld "Field"
>   if "&" is in the htmltext of char i of fld "Field" then
>     put char i of fld "Field" && the htmltext of char i of fld "Field" &
> cr after msg
>   end if
> end repeat
>

Thanks Alex, this looks like the way to go. I hadn't realised I could
get the htmlText of a single character.

Cheers,
Sarah



More information about the use-livecode mailing list