I am using Bitbucket REST API in python script to get the file content from Bitbucket, but I got UnicodeEncodeError since the file contains umlauts character in it, So I used iso-8859-1 encoding as below,
output = obj.text
try:
print(output)
except UnicodeEncodeError as e:
output = obj.text.encode('iso-8859-1')
print(output)
Here the encode done successfully without any further issue, but after the encode the newline characters are converted as literal '\n' characters. So unable to process the encoded file content. How to fix the newline character issue ?