I've made another mini-release. This is simply a REALbasic module which allows quick conversion back and forth between HTML entities, and their actual character.

If you are not sure what I mean, the problem generally arises in XML. For example, in an XML element, characters such as < and > are can mess up the parser. So there are two options: wrap the content in a CDATA section, or convert the content to "XML-Safe" - which this module does.

It also converts back to the original characters, and converts code points as well, but only in UTF-8. These are bits of content that look like &#156; which the gets converted to a character using REALbasic's Chr function. Adding support for customizable encodings should not be difficult.

There are two methods to think about. EscapeHTML and UnescapeHTML. They can be used either as methods of the module, or methods of the string. For example:

MyString = EditField1.Text.EscapeHTML

Or

MyString = HTMLEntities.EscapeHTML(EditField1.Text)

Either method is fine. The module is attached to this post.

Update

The original module had a case-sensitivity mistake. This has been corrected, but it's now a module and a class, rather than just a module. The setup is still quite fast, and self-initializing.