i host jira 4.4 in my company, and configured service 'com.atlassian.jira.service.services.imap.ImapService' to let it receive email from exchange server and automatically create bugs. it works for most of the time.
except a problem:
if the subject of an email is long enough, and the subject is encoded GB2312 chars(chinese), the subject is not correctly decoded.
example:
original data from IMAP response is '* 1 FETCH (FLAGS (\Recent) INTERNALDATE "31-Jan-2012 11:03:20 +0800" RFC822.SIZE 73287 ENVELOPE ("Tue, 31 Jan 2012 11:03:19 +0800" "=?gb2312?B?1Pa808nzxfrIy83119PB+jog0MLPtc2z1tBJQiBwcm9qZWN0IGNvZGW8sA==?==?gb2312?B?yfPF+sK3vra199X7?=" ........'
note that the subject is encoded as "=?gb2312?B?1Pa808nzxfrIy83119PB+jog0MLPtc2z1tBJQiBwcm9qZWN0IGNvZGW8sA==?==?gb2312?B?yfPF+sK3vra199X7?=", because the subject contains Chinese chars.
the correct decoding should result in '增加审批人王子龙: 新系统中IB project code及审批路径调整'
while jira decodes the subject incorrectly, and results in '增加审批人王子龙: 新系统中IB project code及=?gb2312?B?yfPF+sK3vra199X7?='
this problem is probably with the encoding/decoding of more than one encoded words.
i'm seeking help:
how can I correct this decoding, if i'll willing to write some code and patch jira? which piece of code handles that encoding? Or is there an easier way to correct it? Thanks a lot!!
i found this class 'com.atlassian.jira.service.util.handler.CreateOrCommentHandler'. in turn it invokes javax.mail.Message.getSubject()
further i digged out 'javax.mail.internet.MimeUtility.decodeText()', this function decodes the subject and does it wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.