Lost polish character during send attachment by rest api

Igor Kułagowski November 8, 2021

This is part of my code:

File fileUpload = new File("var/Załącznik 123")
assert fileUpload
def part = new RequestFilePart(fileUpload, "file")
def partList = new ArrayList<RequestFilePart>()
partList.add(part)

authenticatedRequestFactory
.createRequest(Request.MethodType.POST, "rest/api/content/" + page_id + "/child/attachment")
.addHeader("X-Atlassian-Token", "no-check")
.addHeader("charset","UTF-8")
.setFiles(partList)
.execute(new ResponseHandler<Response>() {
@Override
void handle(Response response) throws ResponseException {
if(response.statusCode != HttpURLConnection.HTTP_OK) {
//log.debug response.statusCode
//log.debug response.getResponseBodyAsString()
throw new Exception(response.getResponseBodyAsString())
}
}
})  

Finally in confluence is created attachemnt about name: "Za??cznik 123".

How add to object RequestFilePart charset, or maybe, I schould add it other place?

BR,
Igor

 

1 answer

0 votes
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 23, 2022

Hi @Igor Kułagowski

Based on this bug, it looks like Atlassian won't be focusing on fixing it: https://jira.atlassian.com/browse/CONFSERVER-17041

Regards

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events