Brian Dunning's FileMaker Custom Functions

TextToHTMLEntities ( theString )

converts a string into HTML entities

  Average rating: 3.4 (85 votes) Log in to vote

Tom Catchesides   Tom Catchesides
Tom Catchesides
http://www.catchesides.co.uk

Share on Facebook Share on Twitter

  Sample input:
TextToHTMLEntities( "HTML does not like characters such as é & ô" )
  Sample output:
"HTML does not like characters such as é & ô"

  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   Sean, Birmingham
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¢.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 15 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth:

Under construction. Email me your wish list for improvements.