TextToHTMLEntities ( theString )
converts a string into HTML entities
Average rating: 3.4 (85 votes) Log in to vote
Tom Catchesides - Show more from this author
Tom Catchesides http://www.catchesides.co.uk |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
HTML files can only contain a limited set of characters. This custom functions encodes special characters that fall outside this set into HTML entities which - when rendered in a browser - will display the special character.
Comments
Sean, Private Jan 21, 2010 |
||
I would not replace every space with &nsp; as that just gets messy. It's double spaces you have to worry about. So turn [ " " ; " " ] ; into [ " " ; " " ]; which makes the second space a no-breaking space. There are also several issues with characters that may need to be escaped. You may not always want ¶, ", and & converted to an html entity. Just my 2¢. | ||
Philip McGeehan, SMD Ltd Apr 7, 2020 |
||
I needed to add a condition for an apostrophe. Because substitutions are preformed in the order they are listed - the ampersand must be the first condition! If it was not the first condition: "'" gets turned into "'" then "'" gets turned into "'" Hopefully this will save other people getting as confused as I did! |
||
Philip McGeehan, SMD Ltd Apr 7, 2020 |
||
"'" gets turned into "& apos ;" then "& apos ;" gets turned into "& amp ; apos ;" (ignore the spaces above, they are added to stop them getting converted) |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.