The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Comment with broken encoding in attachment

StayAtHome
April 28, 2020

Hello all. I have some trouble with REST API.

If I use comment with non-ANSI (cyrillic) characters for attachment, l get comment with incorrect encoding.
Python code:

from requests import Session
from requests.auth import HTTPBasicAuth

params = {'allowDuplicated': 'true'}
data = {
'comment': 'Тестовий коментар / Test comment',
# 'type': 'text/plain;charset=utf-8', #this line doesn"t change anything
'minorEdit': 'true'
}
files = {'file': ('testfile.txt', open('testfile.txt', 'rb'), 'application/binary')}
session = Session()
session.auth = HTTPBasicAuth('login', 'password')
session.headers['X-Atlassian-Token'] = 'no-check'
page_id=9765696
resp = session.post(f'http://confluence.alfa.bank.int/rest/api/content/{page_id}/child/attachment/', params=params, data=data, files=files).json()
print(resp['results'][0]['version']['message'])

Got comment:

Тестовий коментар / Test comment

 

Any ideas?

0 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

TAGS
AUG Leaders

Atlassian Community Events