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 ?
Hi!
What about using python3 ? Which will cover utf-8
Cheers,
Gonchik
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.