Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
  • Community
  • Products
  • Jira
  • Questions
  • connect to exchange server via IMAP protocol and file bug automatically: long email subjects with Chinese chars are not correctly decoded

connect to exchange server via IMAP protocol and file bug automatically: long email subjects with Chinese chars are not correctly decoded

Xin Tian
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 30, 2012

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!!

1 answer

0 votes
Xin Tian
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
January 30, 2012

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.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events