There is 1 update, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-f8c66a99-0c5f-4977-ae6d-cad17c784c3e XWIKI-17110 Open

Wrong encoding of subject line in notification email

 
View issue   ·   Add comment
 

1 update

 
cid:jira-generated-image-avatar-89b7c2df-2450-495c-b809-5e67b9e7a0ce Changes by Vincent Massol on 16/Jul/26 14:24
 
Assignee: Vincent Massol
 
 

1 comment

 
cid:jira-generated-image-avatar-89b7c2df-2450-495c-b809-5e67b9e7a0ce Vincent Massol on 16/Jul/26 14:24
 

Reply from CC:

This is a genuine bug. The email body is generated with an explicit UTF‑8 charset, but the subject is set via MimeMessage.setSubject(subject) without specifying a charset. JavaMail then encodes the subject header with the JVM's default charset (mail.mime.charset, falling back to file.encoding). On your server that default is not UTF‑8, so the Cyrillic characters in the localized subject get replaced by ?. This also explains why the body is correct while the subject isn't.

Workaround (no code change): force UTF‑8 for mail encoding by adding a JVM system property when starting XWiki: -Dmail.mime.charset=UTF-8
(or, more broadly, -Dfile.encoding=UTF-8). This makes the subject header encode correctly.

Proper fix: the code should call message.setSubject(subject, "UTF-8") so the subject encoding no longer depends on the JVM default charset.

I'm fixing it.