Skip to main content

This content has been archived and is no longer being updated. Links may not function; however, this content may be relevant to outdated versions of the product.

Support Article

FilterRichText gives ASCII for special characters in HTML

SA-45194

Summary



Use of FilterRichText for a property and then display the property value gives ASCII values, instead of special characters( &, @, +, =).


Error Messages



Incorrect display of special characters


Steps to Reproduce



Usecase 1:

Configure a property for user entry and in the advanced tab use "pxFilterRichText" in Edit Input and display the same property value in the next screen(after submit of value), then it shows ASCII values when the special characters are entered.

Scenario 2:

Create a test activity and use "FilterRichtext" function with HTML text "[email protected]" as parameter to the function.


Root Cause




Use of FilterRichText for a property (either in the form of function usage or the edit input pxFilterRichText) and then display the property value gives ASCII values instead of special characters( &, @, +, =).

pxFilterRichText of FilterRichText is used to sanitize the HTML that is provided to it as input. Encoding/Decoding of special characters is not part of its functionality. Hence, as part of sanitization of HTML code passed, the function was converting the special characters to corresponding ASCII entity values.

Resolution



In order to fulfil the requirement, perform below steps:

1. Perform Save As of “pzUnescapeHTMLSpecialChars” into required library in the application ruleset.
2. Add the highlighted part to the newly created function for the conversion of +, =, @ to its text. ( & is already included in the function for its text conversion)



3. Refer this function in one of the activities prior to the property display on UI and after use of FilterRichText, so that one can bring in the values of special characters that have converted to ASCII as part of sanitization in FilterRichText function execution.






4. Run the use case and observe that the values are displayed as required for the property.



5. Refer https://dev.w3.org/html5/html-author/charref to add more character reference entities to the function.

Suggest Edit

Published March 14, 2018 - Updated October 8, 2020

Did you find this content helpful? Yes No

100% found this useful

Have a question? Get answers now.

Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.

We'd prefer it if you saw us at our best.

Pega Community has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.

Close Deprecation Notice
Contact us