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.
Example
dim f as folderItem
dim b as binaryStream

f=getsaveFolderItem("text/html","new.html")
if f<>nil then
b=f.createBinaryFile("text/html")
if b<>nil then
b.write nativeStringMBS(EncodingToHTMLMBS(editfield1.text))
b.close
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.


The biggest plugin in space...