åäö in json payload

I am adding slack notifications to my Octopus Deploy. I am not using the recommended way, instead I’ve
add a post-deployment script that does exactly the same thing as in the recommended way. Why? Eh,reasons…

The problem that I’ve encounterd was that project name contains the character ‘ä‘. When running the message that should be sent to Slack through ConvertTo-Json, ‘ä‘ is converted to ‘BAD+4‘. Some googling
led me to try and wrapp my payload in a [System.Text.Encoding]::UTF8.GetBytes call. So, this is what I ended up with.

Invoke-RestMethod -Method POST -Body ($payload | ConvertTo-Json -Depth 4) -Uri $hook

Invoke-RestMethod -Method POST -Body ([System.Text.Encoding]::UTF8.GetBytes($payload | ConvertTo-Json -Depth 4)) -Uri $hook

And it works!

Octopus deploy notification in Slack
Octopus deploy notification in Slack