I am struggling with trying to encode a string where scandic letters are in utf-8 format.
For example, I would like to convert following
string:
test_string = "\xc3\xa4\xc3\xa4abc"
Into the form of :
test_string = "ääabc"
The end goal is to send this string to Slack-channel via API. I did some testing, and figured out that Slack handles scandic letters properly.
I have tried the following command:
test_string= test_string.encode('latin1').decode('utf-8')
but this does not change the string at all.
Same goes for the more brute-force method:
def simple_scand_convert(string):
string = string.replace("\xc3\xa4", "ä")
Again, this does not change the string at all. Any tips or materials from where I could look for the solution?