EncodeHTML, EncodeUrl, and PlainText functions
Applies to: Canvas apps Desktop flows Model-driven apps Power Pages Power Platform CLI
Encodes and decodes strings.
Description
The EncodeUrl function encodes a URL string, replacing certain non-alphanumeric characters with % and a hexadecimal number.
The EncodeHTML function encodes a string, replacing certain characters that need to be escaped to appear properly in an HTML context. For example, the characters <, >, and & are replaced by <, >, and &, respectively.
The PlainText function removes HTML and XML tags, converting certain tags such as these to an appropriate symbol:
-
- "
The return value from these functions is the encoded or decoded string. This function doesn't remove all HTML and XML tags.
Syntax
EncodeUrl( String )
- String - Required. URL to be encoded.
EncodeHTML( String )
- String - Required. HTML to be encoded.
PlainText( String )
- String - Required. String from which HTML and XML tags are stripped.
Examples
If you show an RSS feed in a text gallery and then set the Text property of a label in that gallery to ThisItem.description, the label might show raw HTML or XML code as in this example:
<p>
We have done an unusually "deep" globalization and
localization.
</p>
If you set the Text property of the label to PlainText(ThisItem.description), the text appears as in this example:
We have done an unusually "deep" globalization and localization.
With the formula EncodeHTML(ThisItem.description), the HTML tags are encoded so that they show up as text when interpreted as HTML, which can be useful to see the HTML structure:
<p>
We have done an unusually&nbsp;&quot;deep&quot; globalization and
localization.
</p>
If instead of a label you have an HTML text control in the gallery, and you set the HtmlText property of that control to ThisItem.description you also see the decoded text, because the HTML text control is interpreting the tags as HTML.