Email template subject encoding | Community
Skip to main content
Martin-Nekula
March 3, 2021
Solved

Email template subject encoding

  • March 3, 2021
  • 2 replies
  • 2775 views

Hello,

we have a long-term problem with encoding in email subjects, where characters like "šáěíéščřý" are not shown correctly. Until now, we have been changing the subjects to use basic ascii letters. But now we are expanding to russian customers, and with azbuka (cyrilic) letters we can no longer do this.

In principle, our mechanism is the same as described here: https://adobe-consulting-services.github.io/acs-aem-commons/features/e-mail/email-api/index.html

Where they are discussing the same problem in the comments below the article, with a final workaround: https://github.com/Adobe-Consulting-Services/acs-aem-commons/pull/1030

However, that would still mean to separate the subject from the template. That would mean additional work with moving the subjects from templates to the i18n dictionary.

So, is this the only solution as to now?

Best Regards

Martin

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Martin-Nekula

Apache Sling Request Parameter Handling configuration for the Default parameter encoding is set correctly to UTF-8, that is not the problem.

With lack of any other answers the workaround mentioned here is still the best approach https://github.com/Adobe-Consulting-Services/acs-aem-commons/pull/1030

2 replies

Kiran_Vedantam
Community Advisor
Community Advisor
March 4, 2021

Hi @martin-nekula,

 

Please check Apache Sling Request Parameter Handling configuration for the Default parameter encoding" for your instance. Generally this encoding is used to display or send the data [which can include special characters as well]. If you are using the AEM default Day CQ Mail Service checking this would be helpful.

 

Hope this helps.

 

Thanks,

Kiran Vedantam.

Martin-Nekula
March 4, 2021

Hello Kiran,

thank you for the answer. Yes, we are using the default one and the encoding is set to UTF-8. I think that shouldn´t be a problem, because the body of the emails is always displayed correctly and if we set the subject in code via

org.apache.commons.mail.HtmlEmail.setSubject()

 then the subject is displayed correctly as well. Problem is when the subject is taken from the mail template.

 

Martin-Nekula
Martin-NekulaAuthorAccepted solution
March 11, 2021

Apache Sling Request Parameter Handling configuration for the Default parameter encoding is set correctly to UTF-8, that is not the problem.

With lack of any other answers the workaround mentioned here is still the best approach https://github.com/Adobe-Consulting-Services/acs-aem-commons/pull/1030

kautuk_sahni
Community Manager
Community Manager
March 15, 2021
Thank you for sharing the solution with AEM community.
Kautuk Sahni