String: EncodingToHTMLMBS

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

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.


💬 Ask a question or report a problem