Scriptrunner French charters not rendered in email subject

Neil Dixon September 4, 2019

Hello,

I currently have and issue with Jira - 7.13.5 and Scriptrunner - 5.5.6

I've created a listners that send an email on a issue update for a given value.

If I place the script in the in line dialoge box the French characters in the subject line are displayed correctly.

If I run the script as a file the French characters are returned as instantané instead of instantané.  

I've tried changing the é to é and this results in é  being displayed in the subject line.

I've been through the trouble shooting guide for French charaters and our db and setting are utf-8.

I've include a code snippet of what we have. 

def String subjectSTR = " instantané " + issue.getKey(); 
sendEmail (NominatorEmail.toString(), subjectSTR.toString(), bodyEmail.toString());

def sendEmail(String recipients, String subject, String body) {
SMTPMailServer mailServer = ComponentAccessor.getMailServerManager().getDefaultSMTPMailServer();
if (mailServer && recipients) {
Email email = new Email(recipients);
email.setMimeType("text/html");
email.setSubject(subject);
email.setBody(body);
mailServer.send(email);
} else {
// Problem getting the mail server from JIRA configuration, log this error
}
};

 Any help would be appreciated.

Thanks.

1 answer

0 votes
Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 5, 2019

Hi @Neil Dixon ,

I do send mail in french and characters are correctly parsed. I would first advise to check that your scripts are encoded in UTF-8. I use a similar method except I am using 

MimeBodyPart mailBodyPart = new MimeBodyPart()
mailBodyPart.setText(content, "UTF-8", "html")
MimeMultipart multipart = new MimeMultipart("mixed");
multipart.addBodyPart(mailBodyPart)
email.setMultipart(multipart);

instead of 

email.setMimeType("text/html")

Also this allows me to add attachments.

Hope that can fix your issue.

Antoine

Antoine Berry
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
September 11, 2019

Hi @Neil Dixon ,

Did you notice any improvement ?

Neil Dixon September 11, 2019

Hi @Antoine Berry 

The body of the emails are displaying fine.  The subject line still doesn't display the characters correctly.

If you have any suggestions let me know.

Thanks again.

Neil

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events