Platforms to show: All Mac Windows Linux Cross-Platform

EncodingToHTMLMBS(s as string, options as Integer = 0) as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
global method String MBS Util Plugin 2.7 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns a string with HTML escaped characters.
dim f as folderItem
dim b as binaryStream

if f<>nil then
if b<>nil then
b.write nativeStringMBS(EncodingToHTMLMBS(editfield1.text))
end if
end if

The source string is converted to unicode if it is not allready in unicode. Than for every character the functions looks for the escaped character code and returns a HTML encoded string.

e.g. "München" -> "M&uuml;nchen"

This functions uses Xojo unicode strings, so you may need to convert back to a NativeString before saveing the string to a file.

Return characters (chr(10) and chr(13)) are not converted to <BR> codes.

May return "" on low memory conditions.

The result of this function is unpredictable on bad input strings.
(e.g. no encoding, or encoding does not match the content of the string)

Options can be 1 to not encode ASCII values < 128, so quotes, <, > and & are not encoded.

Some examples using this global method:

Blog Entries

The items on this page are in the following plugins: MBS Util Plugin.

💬 Ask a question or report a problem
The biggest plugin in space...