HTTP/OAuth does not process UTF-8 characters

Which IIQ version are you inquiring about?

Tested on versions 8.3p1 and 8.4p2.

Please share any images or screenshots, if relevant.

Email processed correctly:

Email processed incorrectly:

Share all details about your problem, including any error messages you may have received.

Hi experts!

We’re encountering an issue when sending emails via HTTP/OAuth. Our EmailTemplates include UTF‑8 characters that must be rendered correctly. Previously we used SMPT/Basic, but now we need to switch to HTTP/OAuth.

When we run the exact same test -using the same EmailTemplate but changing only the method- the UTF‑8 characters are replaced by the replacement character “�” (see attached screenshots).

Rule code used for the test:

  import sailpoint.object.EmailTemplate;
  import sailpoint.object.EmailOptions;
  
  import org.apache.log4j.Logger;
  import org.apache.log4j.Level;

  Logger log = Logger.getLogger("Aux-Rule-SendTestEmail");
  log.setLevel(Level.DEBUG);
	
  log.debug("Entering Aux-Rule-SendTestEmail");
  
  // Parameters
  String identity_name = "ABCD1234";
  String template = "Aux-EmailTemplate-TestUTF-8";
  String to_addresses = "{my email address}";

  EmailTemplate emailTemplate = context.getObject(EmailTemplate.class, template); 
  if (emailTemplate != null) { 
    Map args = new HashMap(); 
    args.put("identityName", identity_name); 
    EmailOptions emailOptions = new EmailOptions(); 
    emailOptions.setTo(to_addresses); 
    emailOptions.setVariables(args); 
    log.debug("Before sending email");
    context.sendEmailNotification(emailTemplate, emailOptions);
  }
  
  log.debug("Email sent!");
  return "Sent!";

EmailTemplate definition:

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE EmailTemplate PUBLIC "sailpoint.dtd" "sailpoint.dtd">
<EmailTemplate name="Aux-EmailTemplate-TestUTF-8">
  <Body>
    #set($ctx = $spTools.class.forName("sailpoint.api.SailPointFactory").getMethod("getFactory", null).invoke(null,null).getCurrentContext()) 
	#set($identity = $ctx.getObjectByName($spTools.class.forName("sailpoint.object.Identity"), $identityName))

    	&lt;html>
    		&lt;head>
     			&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                &lt;meta name="viewport" content="width=device-width, initial-scale=1.0">
        	    &lt;meta name="x-apple-disable-message-reformatting">
    		&lt;/head>
    		&lt;body>
					&lt;div style="font-family: Arial, sans-serif; font-size:14px; padding-bottom:10px; border-bottom:10px solid #000; margin-top:10px">
    				&lt;div style="border-bottom:3px solid #000; border-top:1px solid #000; text-align:center;">
        			&lt;h1 style="color:#000; font-size:20px; line-height:25px; text-transform:uppercase; ">
								 TEST UTF-8 
							&lt;/h1>
    				&lt;/div>
    				&lt;p style="line-height:18px; text-align:justify">
							Hello world! ñ á é í ó ú ü
    					
    					&lt;br/>
    					Identity Name: $identityName
						&lt;/p>
					&lt;/div>
    		&lt;/body>
			&lt;/html>
    
  </Body>
  <Description>
      Email template for testing
    </Description>
  <Signature>
    <Inputs>
      <Argument name="identityName" type="string">
        <Description>The full name user.</Description>
      </Argument>
    </Inputs>
  </Signature>
  <Subject>TEST UTF-8</Subject>
</EmailTemplate>

Thanks in advance for your help!

hi Victor,
I see in the EmailTemplate definition you are alredy setting the content-type as “text/html; charset=UTF-8” and that should take care of the these special char and render them correctly. In your rule can you print the emailTemplate and see what you are getting. May be you need to get the body from emailTemplate and do the conversion and set it back.

Hi there!
First of all, thanks for your suggestion. I printed the emailTemplate object I’m receiving, and it already contains the special UTF‑8 characters correctly. However, this rule is only a simple test for sending emails, the OOTB email actions in our workflows also mis‑process these characters.