0

Is there any way to pass special language characters such as 'ąęćń' in the subject of an email template in fusionauth ?

Lechu67
  • 35
  • 5
  • This should work already. Can you provide additional details such as operating system version, browser version, database type and version? – robotdan Jul 22 '19 at 14:34
  • The problem was on all systems. After some time of search bellow there is a solution to the problem. – Lechu67 Jul 23 '19 at 08:17

1 Answers1

1

The solution is to encode the string subject as MIME header using javax.mail.internet.MimeUtility

MimeUtility.encodeText(subject, "utf-8", "B")
Lechu67
  • 35
  • 5
  • Thanks! I'll do some additional testing with this code to see if I can replicate and then resolve the issue. – robotdan Jul 23 '19 at 15:05
  • The `MimeMessage.setSubject` does use `MimeUtility.encodeText` - but it we were using `Message.setSubject` which passes `null` as the character set so if the operating system was using `UTF-8` it would work, or if the OS was set to something else - or if it defaulted to `ISO-8859_1` the subject would be rendered as `???` upon delivery. This will be corrected, thanks! – robotdan Jul 23 '19 at 16:48
  • Bug will be fixed under this issue. https://github.com/FusionAuth/fusionauth-issues/issues/231 – robotdan Jul 23 '19 at 16:51
  • Great ! Same problem occured when I was adding the email template content as html. Without calling `new String(html, encoding)` where encoding was explicitly `UTF-8` fusionauth was not reading the characters properly. This seems a normal behavior however I suggest to add this information somewhere in the documentation. – Lechu67 Jul 24 '19 at 14:53
  • Thanks @Lechu67 we'll do a few other checks to make sure we've got all of this fixed up for the next release. Thanks for the assist! – robotdan Jul 24 '19 at 17:59