Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
Community Members
Community Events
Community Groups

Scriptrunner special characters in attachment's filename encoding


Hi guys,

I am trying to synchronize attachments between two instances. I have this code:

def attachment = get("{attachmentId}") // get the content binary data
.basicAuth("", "token")

def attachmentData = get("{attachmentId}") // get the attachment metadata
.basicAuth("", "token")

def fileName = attachmentData['filename'] as String

InputStream stream = new ByteArrayInputStream(attachment.getBytes()) // create a file to send

def sendAttachment = post("/rest/api/3/issue/{issueID}/attachments")
.header("Accept", "application/json")
.header("X-Atlassian-Token", "no-check")
.field("file", stream, new String(fileNameData.getBytes("UTF-8"), "UTF-8"))

I can upload the attachment into an issue, but if it's name contains special character like "Český jazyk.txt" it will replace the characters by "?", so the name of created attachment will be "?esk? jazyk.txt". And this is the problem I need to resolve.

Many thanks for any suggestions.


0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Software

An update on Jira Software customer feedback – June 2022

Hello Atlassian Community! Feedback from customers like you has helped us shape and improve Jira Software. As Head of Product, Jira Software, I wanted to take this opportunity to share an update on...

177 views 2 5
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you