Special character usage inside email template html

  • 7011195
  • 29-May-2012
  • 19-Oct-2012

Resolution

Question:

I have an email template that needs to utilize special characters. When I include them in a default email template, they come through the mail system just fine, but when my special characters are contained within html tags, the received email has question marks in place of said special characters. How can I remedy this isssue?

Answer:

When using special characters inside html tags, they must be properly escaped. This requirement has nothing to do with identityIQ

Take the following example:

       <html>
       <body>
                Polish characters test: zażółć gęślÄ… jaźń
       </body>
       </html>

If one were to put the above text into an identiyIQ email template, the text, as viewed in the actual received email would look like so:

Polish characters test: za???? g??l? ja??

To remedy this, the special characters must be escaped. One way to accomplish this is to use actual escape character values like so:

       <html>
       <body>
                Polish characters test: za&amp;#380;&amp;#243;&amp;#322;&amp;#263; g&amp;#281;&amp;#347;l&amp;#261; ja&amp;#378;&amp;#324;
       </body>
       </html>

The problem here is that the above is difficult to read and requires extra work on the identityIQ deployment engineer. Another problem is that if you are passing special characters into the email template, as part of a variable, then you obviously can not pre-code the template with the proper escape character representation.

Sailpoint provides a method to automatically generate the proper escape characters before sending the email to your mail server. The above would look like the following:

       <html>
       <body>
                $spTools.escapeHtml("Polish characters test: zażółć gęślÄ… jaźń")
       </body>
       </html>

If you are dealing with variables within your email template that might contain special characters, you would do so like this:

       <html>
       <body>
                $spTools.escapeHtml($roleName)
       </body>
       </html>