Custom mail listener, set UTF-8 encoding in email header for attachment name

Hi,

how to set UTF-8 encoding for the name of attachments in email header? Have Croatian letters in the name of the file. For example a text file called: "att_ććććć.txt" . After the email was send to specific email address the name of the file gets wrong formatted: "att_???". I tried:

new String(attachment.getFilename().getBytes("CP1250"), "UTF-8")

and:

Email.setMimeType("text/html")
Email.setEncoding("utf-8")

and:

MimeBodyPart.setHeader("Content-Type", "text/html")
MimeBodyPart.setHeader("Content-Transfer-Encoding", "quoted-printable")

 

And still won't display the name of the file correctly. Can anyone help?

Best Regards,

Ivan

3 answers

could you please share the solution, I am trying to find a way to enable the site-wide support for cro letters?

Hi Sasha, sorry for the late response. You can check the solution on http://stackoverflow.com/questions/3451256/javamail-changing-charset-of-subject-line Look at "MimeUtility.encodeText" part. Regards, Ivan

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Marketplace Apps

Tips on how to choose the best estimation method for your planning

Planning and grooming sessions all come with their own sets of rules. Team members meet to estimate stories or other work items, all according to an agreed-upon process. And with every session comes ...

67 views 0 11
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you