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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events