Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

Text.EncodeToHTML

Encodes text as html.

Component Version macOS Windows Linux Server iOS SDK
Text 2.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "Text.EncodeToHTML"; text { ; mode } )   More

(old name: String.EncodeToHTML)

Parameters

Parameter Description Example Flags
text The text you want to encode. "Grüße"
mode Default 0 for using named entities.
Pass 1 for decimal and 2 for hex encoded numbers instead.
Add 8 to encode all characters (new in plugin version 8.4)
0 Optional

Result

The encoded text.

Description

Encodes text as html.
All special and unicode characters are escaped.
Lower ASCII control characters are ignored.

You may want to use Text.ReplaceNewline after this function to replace new line characters with <br> (mode 4) or <br /> (mode 5).

Examples

Encode text as html

MBS( "Text.EncodeToHTML"; "Grüße" )

Example result: "Gr&uuml;&szlig;e"

Encode smileys:

MBS("Text.EncodeToHTML"; "😀😁😂😃")

Example result: "&#128512;&#128513;&#128514;&#128515;"

Encode ä three ways:

MBS( "Text.EncodeToHTML"; "ä"; 0) & ¶ &
MBS( "Text.EncodeToHTML"; "ä"; 1) & ¶ &
MBS( "Text.EncodeToHTML"; "ä"; 2)

Encode normal and all with decimal or hexadecimal:

MBS("Text.EncodeToHTML"; "Hello World ä"; 0) & ¶ &
MBS("Text.EncodeToHTML"; "Hello World ä"; 8) & ¶ &
MBS("Text.EncodeToHTML"; "Hello World ä"; 8+2)

Example result:
"Hello World &auml;
&#72;&#101;&#108;&#108;&#111;&#32;&#87;&#111;&#114;&#108;&#100;&#32;&auml;
&#x48;&#x65;&#x6c;&#x6c;&#x6f;&#x20;&#x57;&#x6f;&#x72;&#x6c;&#x64;&#x20;&#xe4;"

Encode some fruits:

MBS( "Text.EncodeToHTML"; "🍎 🍓 🍒" )

Example result: &#127822; &#127827; &#127826;

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 31st January 2023


Text.EncodeToBytes - Text.EncodeToHex